chore: update document approval workflow and bug fixes
This commit is contained in:
46
Modules/MaterialLogistics/app/Models/InventoryBatch.php
Normal file
46
Modules/MaterialLogistics/app/Models/InventoryBatch.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\MaterialLogistics\Models;
|
||||
|
||||
use App\Traits\HasPublicIdentifier;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Modules\MasterData\Models\Material;
|
||||
|
||||
class InventoryBatch extends Model
|
||||
{
|
||||
use HasPublicIdentifier;
|
||||
|
||||
protected $fillable = [
|
||||
'warehouse_id', 'material_id', 'material_requisition_id', 'purchase_order_id',
|
||||
'quantity', 'unit_cost',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'quantity' => 'decimal:2',
|
||||
'unit_cost' => 'decimal:2',
|
||||
];
|
||||
}
|
||||
|
||||
public function warehouse(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Warehouse::class);
|
||||
}
|
||||
|
||||
public function material(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Material::class);
|
||||
}
|
||||
|
||||
public function requisition(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(MaterialRequisition::class, 'material_requisition_id');
|
||||
}
|
||||
|
||||
public function purchaseOrder(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(PurchaseOrder::class, 'purchase_order_id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user