45 lines
1.1 KiB
PHP
45 lines
1.1 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Modules\Production\Models;
|
||
|
|
|
||
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||
|
|
use Illuminate\Database\Eloquent\Model;
|
||
|
|
use App\Modules\Inventory\Models\Product;
|
||
|
|
|
||
|
|
class ProductionOrderItem extends Model
|
||
|
|
{
|
||
|
|
/** @use HasFactory<\Database\Factories\ProductionOrderItemFactory> */
|
||
|
|
use HasFactory;
|
||
|
|
|
||
|
|
protected $fillable = [
|
||
|
|
'production_order_id',
|
||
|
|
'inventory_id',
|
||
|
|
'quantity_used',
|
||
|
|
'unit_id',
|
||
|
|
];
|
||
|
|
|
||
|
|
protected $casts = [
|
||
|
|
'quantity_used' => 'decimal:4',
|
||
|
|
];
|
||
|
|
|
||
|
|
public function inventory()
|
||
|
|
{
|
||
|
|
return $this->belongsTo(\App\Modules\Inventory\Models\Inventory::class);
|
||
|
|
}
|
||
|
|
|
||
|
|
public function unit()
|
||
|
|
{
|
||
|
|
return $this->belongsTo(\App\Modules\Inventory\Models\Unit::class);
|
||
|
|
}
|
||
|
|
|
||
|
|
public function productionOrder(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||
|
|
{
|
||
|
|
return $this->belongsTo(ProductionOrder::class);
|
||
|
|
}
|
||
|
|
|
||
|
|
public function product(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||
|
|
{
|
||
|
|
return $this->belongsTo(Product::class);
|
||
|
|
}
|
||
|
|
}
|