Files
kulakpos_web/app/Models/PurchaseDetails.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

70 lines
1.6 KiB
PHP

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