Files
star-erp/app/Modules/Inventory/Models/InventoryAdjustItem.php

37 lines
783 B
PHP
Raw Normal View History

<?php
namespace App\Modules\Inventory\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class InventoryAdjustItem extends Model
{
use HasFactory;
protected $fillable = [
'adjust_doc_id',
'product_id',
'batch_number',
'qty_before',
'adjust_qty', // 增減數量
'notes',
];
protected $casts = [
'qty_before' => 'decimal:2',
'adjust_qty' => 'decimal:2',
];
public function doc(): BelongsTo
{
return $this->belongsTo(InventoryAdjustDoc::class, 'adjust_doc_id');
}
public function product(): BelongsTo
{
return $this->belongsTo(Product::class);
}
}