28 lines
536 B
PHP
28 lines
536 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class ProductSaleItem extends Model
|
|
{
|
|
protected $fillable = [
|
|
'product_sale_id',
|
|
'product_id',
|
|
'quantity',
|
|
'unit_price',
|
|
'subtotal'
|
|
];
|
|
|
|
public function sale(): BelongsTo
|
|
{
|
|
return $this->belongsTo(ProductSale::class, 'product_sale_id');
|
|
}
|
|
|
|
public function product(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Product::class);
|
|
}
|
|
}
|