Level 102
I assume that it is a collection
$job->shipper->addresses->src_des->first();
Hi there, I have a function in my controller like bellow
public function notifyShipper(){
$job = Job::with('shipper', 'jobstatus')->find($id);
return $job;
}
returned object in console is like bellow
{
....
....
shipper: {
addresses:{
name: "Ali"
src_des: [
{
id: 21,
company: "zia",
address: "some fake address",
},
{
id: 22,
company: "xia",
address: "some fake address",
}
]
}
}
}
if I return $job->shipper->addresses->name, I get "Ali", but
if I return $job->shipper->addresses->src_des, I get nothing
Please or to participate in this conversation.