44 lines
1020 B
PHP
44 lines
1020 B
PHP
<?php
|
|
|
|
namespace Modules\Maintenance\Models;
|
|
|
|
use App\Business;
|
|
use App\User;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class MaintenanceToolTransaction extends Model
|
|
{
|
|
protected $table = 'maintenance_tool_transactions';
|
|
|
|
protected $fillable = [
|
|
'business_id', 'tool_id', 'type', 'user_id', 'work_order_id', 'equipment_id',
|
|
'transaction_at', 'expected_return_at', 'returned_at', 'notes', 'performed_by',
|
|
];
|
|
|
|
protected $casts = [
|
|
'transaction_at' => 'datetime',
|
|
'expected_return_at' => 'datetime',
|
|
'returned_at' => 'datetime',
|
|
];
|
|
|
|
public function tool()
|
|
{
|
|
return $this->belongsTo(MaintenanceTool::class, 'tool_id');
|
|
}
|
|
|
|
public function user()
|
|
{
|
|
return $this->belongsTo(User::class, 'user_id');
|
|
}
|
|
|
|
public function workOrder()
|
|
{
|
|
return $this->belongsTo(WorkOrder::class, 'work_order_id');
|
|
}
|
|
|
|
public function equipment()
|
|
{
|
|
return $this->belongsTo(Equipment::class, 'equipment_id');
|
|
}
|
|
}
|