Erster Upload
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Product extends Model
|
||||
{
|
||||
protected $fillable = ['title', 'description', 'images', 'package_content', 'recipes_id'];
|
||||
|
||||
protected $casts = [
|
||||
'images' => 'array',
|
||||
];
|
||||
|
||||
|
||||
public function recipe()
|
||||
{
|
||||
return $this->belongsTo(Recipe::class, 'recipes_id');
|
||||
}
|
||||
|
||||
public function sizes()
|
||||
{
|
||||
return $this->belongsToMany(Packing::class, 'products_sizes')
|
||||
->withPivot('price')
|
||||
->withPivot('description')
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
public function inventories()
|
||||
{
|
||||
return $this->hasMany(ProductInventory::class);
|
||||
}
|
||||
|
||||
public function batches()
|
||||
{
|
||||
return $this->hasMany(Batch::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user