Open giorgosstab opened 4 years ago
$this->has_many_pivot['vehicles'] = array(
'foreign_model'=>'Vehicle_model',
'pivot_table'=>'customer_vehicles',
'local_key'=>'id',
'pivot_local_key'=>'customer_id',
'pivot_foreign_key'=>'vehicle_id',
'foreign_key'=>'id',
'get_relate'=> true
);
And my print data
stdClass Object
(
[id] => 1
[name] => Giorgos Tsaxrelias
[username] => giorgosstab
[email] => tsaxre1991@hotmail.com
[phone] => 6985678134
[password] => $2y$10$wgryeRnWTIV6S4f35NyJTedhwMFJ3sAR2kTHzkiRHosEW3o6bblCW
[address] => TestAddress
[status] => ACTIVE
[created_at] => 2019-11-27 14:05:23
[updated_at] => 2019-12-11 09:34:51
[vehicles] => stdClass Object
(
[1] => stdClass Object
(
[id] => 1
[license_plate] => AXZ 5461
[slug] => axz-5461
[color] => red
[notes] => Test Notes
[status] => INACTIVE
[created_at] => 2019-11-27 14:12:10
[updated_at] => 2019-11-28 11:34:40
)
[3] => stdClass Object
(
[id] => 3
[license_plate] => ABE 5509
[slug] => abe-5509
[color] => red
[notes] =>
[status] => ACTIVE
[created_at] => 2019-11-28 09:16:09
[updated_at] => 2019-11-29 12:01:07
)
)
)
and i want only active vehicles
hey avenir i am curious if it is possible to query articles_with_authors in your test controller with get_related = true in model pivot table but what happen if i have a status enum in authors and need only active authors in my query? @avenirer