Files
kulakpos_web/app/Models/SaleDetails.php
eko54r 2fabdf8fc9
All checks were successful
Build, Push and Deploy / build-and-push (push) Successful in 4m17s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 15s
Build, Push and Deploy / deploy-staging (push) Successful in 41s
Build, Push and Deploy / deploy-production (push) Has been skipped
update perbaikan pos, return, dan report profit nlost
2026-05-14 22:19:01 +07:00

68 lines
1.4 KiB
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Factories\HasFactory;
class SaleDetails extends Model
{
use HasFactory;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'sale_id',
'product_id',
'price',
'discount',
'lossProfit',
'quantities',
'stock_id',
'expire_date',
'mfg_date',
'productPurchasePrice',
'warranty_guarantee_info',
'serial_numbers',
];
/**
* Indicates if the model should be timestamped.
*
* @var bool
*/
public $timestamps = false;
public function product(): BelongsTo
{
return $this->belongsTo(Product::class, 'product_id');
}
public function stock()
{
return $this->belongsTo(Stock::class);
}
public function sale(): BelongsTo
{
return $this->belongsTo(Sale::class, 'sale_id');
}
protected $casts = [
'sale_id' => 'integer',
'stock_id' => 'integer',
'product_id' => 'integer',
'price' => 'double',
'discount' => 'double',
'lossProfit' => 'double',
'quantities' => 'double',
'productPurchasePrice' => 'double',
'warranty_guarantee_info' => 'json',
'serial_numbers' => 'json',
];
}