2026-10-12 23:47:41 +07:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
|
|
|
|
|
|
class SecurityGuard extends Model
|
|
|
|
|
{
|
|
|
|
|
use HasFactory;
|
|
|
|
|
|
|
|
|
|
protected $fillable = [
|
2026-10-13 13:46:35 +07:00
|
|
|
'badge_id',
|
2026-10-12 23:47:41 +07:00
|
|
|
'name',
|
2026-10-13 13:46:35 +07:00
|
|
|
'team',
|
|
|
|
|
'gate_id',
|
|
|
|
|
'user_id',
|
2026-10-12 23:47:41 +07:00
|
|
|
'is_active',
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
protected $casts = [
|
|
|
|
|
'is_active' => 'boolean',
|
2026-10-13 13:46:35 +07:00
|
|
|
'team' => 'integer',
|
2026-10-12 23:47:41 +07:00
|
|
|
];
|
|
|
|
|
|
2026-10-13 13:46:35 +07:00
|
|
|
public function gate()
|
|
|
|
|
{
|
|
|
|
|
return $this->belongsTo(Gate::class);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function user()
|
|
|
|
|
{
|
|
|
|
|
return $this->belongsTo(User::class);
|
|
|
|
|
}
|
|
|
|
|
|
2026-10-12 23:47:41 +07:00
|
|
|
public function activities(): HasMany
|
|
|
|
|
{
|
|
|
|
|
return $this->hasMany(VehicleActivity::class);
|
|
|
|
|
}
|
|
|
|
|
}
|