This return me a full json off all table but i want only table 5 item in my json. Else i can concat all array of table 5 together to make my full table 5 item. Do you have something more optimize ?
@jak645 something is wrong here if you want to go from table1 to table5 through 3 tables ( just to grab table 5 ). Can you add for example relationships between table1 and table5?
class Home extends Model
{
use SoftDeletes;
protected $table = 'homes';
protected $fillable = ['title','description','adresse'];
protected $guarded = ['id','deleted_at'];
public function users(){
return $this->belongsToMany('App\User','homes_users','homes_id','users_id');
}
public function rooms(){
return $this->hasMany('App\Room','home_id');
}
}