ekart/backend/app/Models/Product.php
kusowl 684b7585bb feature: product creation and image upload
create image upload endpoint
create product creation endpoint
create get product categories endpoint
2026-02-26 19:03:41 +05:30

29 lines
603 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
class Product extends Model
{
protected $fillable = [
'title',
'actual_price',
'list_price',
'description',
'product_category_id',
];
public function productCategory(): BelongsTo
{
return $this->belongsTo(ProductCategory::class);
}
public function images(): HasMany
{
return $this->hasMany(ProductImage::class, 'product_id', 'id');
}
}