33 lines
569 B
PHP
33 lines
569 B
PHP
|
<?php
|
||
|
|
||
|
namespace App;
|
||
|
|
||
|
use App\Models\Product;
|
||
|
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);
|
||
|
}
|
||
|
|
||
|
}
|