56 lines
1.2 KiB
PHP
56 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace Modules\Maintenance\Models;
|
|
|
|
use App\BusinessLocation;
|
|
use App\Contact;
|
|
use App\Transaction;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class MaterialProcurement extends Model
|
|
{
|
|
protected $table = 'maintenance_material_procurements';
|
|
|
|
protected $fillable = [
|
|
'material_line_id',
|
|
'transaction_id',
|
|
'procurement_type',
|
|
'quantity',
|
|
'source_location_id',
|
|
'destination_location_id',
|
|
'supplier_id',
|
|
'status',
|
|
'meta',
|
|
];
|
|
|
|
protected $casts = [
|
|
'quantity' => 'decimal:3',
|
|
'meta' => 'array',
|
|
];
|
|
|
|
public function materialLine()
|
|
{
|
|
return $this->belongsTo(MaterialLine::class, 'material_line_id');
|
|
}
|
|
|
|
public function transaction()
|
|
{
|
|
return $this->belongsTo(Transaction::class);
|
|
}
|
|
|
|
public function sourceLocation()
|
|
{
|
|
return $this->belongsTo(BusinessLocation::class, 'source_location_id');
|
|
}
|
|
|
|
public function destinationLocation()
|
|
{
|
|
return $this->belongsTo(BusinessLocation::class, 'destination_location_id');
|
|
}
|
|
|
|
public function supplier()
|
|
{
|
|
return $this->belongsTo(Contact::class, 'supplier_id');
|
|
}
|
|
}
|