first
This commit is contained in:
76
app/Models/StaffAssignment.php
Normal file
76
app/Models/StaffAssignment.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Database\Factories\StaffAssignmentFactory;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class StaffAssignment extends Model
|
||||
{
|
||||
/** @use HasFactory<StaffAssignmentFactory> */
|
||||
use HasFactory, SoftDeletes;
|
||||
|
||||
protected $guarded = [];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'assigned_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
public function election(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Election::class);
|
||||
}
|
||||
|
||||
public function application(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Application::class);
|
||||
}
|
||||
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function position(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Position::class);
|
||||
}
|
||||
|
||||
public function pusatMengundi(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(PusatMengundi::class);
|
||||
}
|
||||
|
||||
public function saluranMengundi(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(SaluranMengundi::class);
|
||||
}
|
||||
|
||||
public function reportsTo(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(self::class, 'reports_to_assignment_id');
|
||||
}
|
||||
|
||||
public function teamMembers(): HasMany
|
||||
{
|
||||
return $this->hasMany(self::class, 'reports_to_assignment_id');
|
||||
}
|
||||
|
||||
public function histories(): HasMany
|
||||
{
|
||||
return $this->hasMany(StaffAssignmentHistory::class);
|
||||
}
|
||||
|
||||
public function attendance(): HasOne
|
||||
{
|
||||
return $this->hasOne(Attendance::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user