let see my Model :
public function childs() {
return $this->hasMany('App\Models\BusinessModel','parent_id','id') ;
}
public function parent() {
return $this->hasOne('App\Models\BusinessModel','id','parent_id') ;
}
public function users() {
return $this->hasManyThrough('App\Models\User','App\Models\BusinessModelUser','business_model_id','id') ;
}
public function get_team() {
return $this->parent->childs;
}
I want to get all users for team ( get by get_team()
function ). Is there any way that can help me get all user in a team without use:
foreach ($abc->get_team as $item ){
$item->users;
}
...
Sorry, my english so bad. Hope you understand. Please help me. thank you .
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2Ys16rm
via IFTTT
Aucun commentaire:
Enregistrer un commentaire