pai-sklep/app/Models/Product.php
2021-12-08 23:39:53 +01:00

28 lines
568 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Product extends Model
{
use HasFactory;
use HasUUID;
public $primaryKey = "uuid";
public function images() {
return $this->morphMany(Image::class, 'imageable');
}
public function categories() {
return $this->belongsToMany(Category::class,'categories_products','product_uuid');
}
protected $fillable = [
'name',
'description',
'images',
'price'
];
}