38 lines
815 B
PHP
38 lines
815 B
PHP
<?php
|
|
|
|
namespace Modules\Admin\app\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Equipment extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->table = 'equipments';
|
|
$this->guarded = [];
|
|
}
|
|
|
|
public function currentUser()
|
|
{
|
|
return $this->belongsTo(\App\Models\User::class, 'current_user_id');
|
|
}
|
|
|
|
public function assignments()
|
|
{
|
|
return $this->hasMany(EquipmentAssignment::class, 'equipment_id')->orderBy('assigned_at', 'desc');
|
|
}
|
|
|
|
public function creator()
|
|
{
|
|
return $this->belongsTo(\App\Models\User::class, 'created_by');
|
|
}
|
|
|
|
public function updater()
|
|
{
|
|
return $this->belongsTo(\App\Models\User::class, 'updated_by');
|
|
}
|
|
}
|