feat: complete master satpam with ID, Regu 1/2/3, Penempatan, and auto-generated guard login accounts
This commit is contained in:
@@ -11,14 +11,29 @@ class SecurityGuard extends Model
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'badge_id',
|
||||
'name',
|
||||
'team',
|
||||
'gate_id',
|
||||
'user_id',
|
||||
'is_active',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'is_active' => 'boolean',
|
||||
'team' => 'integer',
|
||||
];
|
||||
|
||||
public function gate()
|
||||
{
|
||||
return $this->belongsTo(Gate::class);
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function activities(): HasMany
|
||||
{
|
||||
return $this->hasMany(VehicleActivity::class);
|
||||
|
||||
@@ -6,6 +6,7 @@ namespace App\Models;
|
||||
use Database\Factories\UserFactory;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
|
||||
@@ -56,6 +57,11 @@ class User extends Authenticatable
|
||||
return $this->belongsTo(Gate::class);
|
||||
}
|
||||
|
||||
public function securityGuard(): HasOne
|
||||
{
|
||||
return $this->hasOne(SecurityGuard::class);
|
||||
}
|
||||
|
||||
public function isGateOfficer(): bool
|
||||
{
|
||||
return $this->role === 'gate_officer';
|
||||
|
||||
Reference in New Issue
Block a user