AP
Size: a a a
AP
w
VY
$bookCategories = $author->books()->with('category')->get();
w
w
VY
w
w
w
VY
ЭБ
public function products()
{
$model = '';
switch ($this->product_type_id)
{
case 1:
$model = 'App\Models\RollProduct';
break;
case 2:
$model = 'App\Models\ZebraProduct';
break;
case 3:
$model = 'App\Models\VertProduct';
break;
case 4:
$model = 'App\Models\GorizProduct';
break;
}
return $this->hasMany($model);
}
BS
public function products()
{
$model = '';
switch ($this->product_type_id)
{
case 1:
$model = 'App\Models\RollProduct';
break;
case 2:
$model = 'App\Models\ZebraProduct';
break;
case 3:
$model = 'App\Models\VertProduct';
break;
case 4:
$model = 'App\Models\GorizProduct';
break;
}
return $this->hasMany($model);
}
BS
if ($order->isRollProduct()) {
$products = $order->rollProducts()
}
ЭБ
BS
BS
ЭБ
BS
ЭБ
BS