class BannerItem
{
public function img()
{
return $this->belongsTo('Image', 'img_id', 'id');
}
}
class Banner extends BaseModel
{
public function items()
{
return $this->hasMany('BannerItem', 'banner_id', 'id');
}
}
class Image
{
}
public function getBannerById($id)
{
$banner = banerModel::with(['items','items.img'])->find($id);
$banner = banerModel::with(‘item’)->find($id);
return $banner;
}