Skip to main content

has_many

Macro has_many 

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

Macro deklarasi relasi Has Many (1 to N) bergaya Laravel.

§Contoh Penggunaan:

ⓘ
impl User {
    // Sintaks 1 baris manusiawi:
    has_many!(posts: Post, "user_id");
    // Atau otomatis foreign key "user_id":
    has_many!(posts: Post);
}