Skip to main content

has_one

Macro has_one 

Source
macro_rules! has_one {
    ($fn_name:ident : $related:ident, $fk:expr) => { ... };
    ($fn_name:ident : $related:ident) => { ... };
}
Expand description

Macro deklarasi relasi Has One (1 to 1) bergaya Laravel.

§Contoh Penggunaan:

ⓘ
impl User {
    has_one!(profile: Profile, "user_id");
    // Atau otomatis:
    has_one!(profile: Profile);
}