ultimatepos/Modules/ShopFloor/Models/ProductionEvent.php

39 lines
851 B
PHP

<?php
namespace Modules\ShopFloor\Models;
use App\User;
use Illuminate\Database\Eloquent\Model;
use Modules\IndustrialEngineering\Models\ManufacturingWorkOrder;
class ProductionEvent extends Model
{
use BelongsToBusiness;
protected $table = 'sf_production_events';
protected $guarded = ['id'];
protected $casts = [
'quantity' => 'decimal:4',
'good_quantity' => 'decimal:4',
'scrap_quantity' => 'decimal:4',
'recorded_at' => 'datetime',
];
public function workCenter()
{
return $this->belongsTo(WorkCenter::class, 'work_center_id');
}
public function workOrder()
{
return $this->belongsTo(ManufacturingWorkOrder::class, 'ie_work_order_id');
}
public function recordedBy()
{
return $this->belongsTo(User::class, 'recorded_by');
}
}