2019-12-15 15:45:22 +01:00
|
|
|
<?php
|
|
|
|
|
2020-01-06 17:14:54 +01:00
|
|
|
namespace App\Models;
|
2019-12-15 15:45:22 +01:00
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
use App\Traits\HasCompositeKey;
|
|
|
|
|
|
|
|
class RecipeProduct extends Model
|
|
|
|
{
|
|
|
|
use HasCompositeKey;
|
|
|
|
|
|
|
|
protected $primaryKey = ['recipe_id', 'product_id'];
|
|
|
|
|
|
|
|
protected $with = ['product'];
|
|
|
|
|
|
|
|
public $incrementing = false;
|
|
|
|
|
|
|
|
public $timestamps = false;
|
|
|
|
|
|
|
|
protected $table = 'recipe_products';
|
|
|
|
|
|
|
|
protected $guarded = ['id'];
|
|
|
|
|
|
|
|
protected $hidden = ['recipe_id', 'product_id'];
|
|
|
|
|
|
|
|
public function product()
|
|
|
|
{
|
|
|
|
return $this->belongsTo(Product::class);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|