32 lines
552 B
PHP
32 lines
552 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
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);
|
|
}
|
|
|
|
}
|