first
This commit is contained in:
77
app/Models/Application.php
Normal file
77
app/Models/Application.php
Normal file
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Database\Factories\ApplicationFactory;
|
||||
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 Application extends Model
|
||||
{
|
||||
/** @use HasFactory<ApplicationFactory> */
|
||||
use HasFactory, SoftDeletes;
|
||||
|
||||
protected $guarded = [];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'approved_at' => 'datetime',
|
||||
'rejected_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
public function election(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Election::class);
|
||||
}
|
||||
|
||||
public function pusatMengundi(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(PusatMengundi::class);
|
||||
}
|
||||
|
||||
public function selectedKtmAssignment(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(StaffAssignment::class, 'selected_ktm_assignment_id');
|
||||
}
|
||||
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function requestedPosition(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Position::class, 'requested_position_id');
|
||||
}
|
||||
|
||||
public function approvedPosition(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Position::class, 'approved_position_id');
|
||||
}
|
||||
|
||||
public function documents(): HasMany
|
||||
{
|
||||
return $this->hasMany(ApplicationDocument::class);
|
||||
}
|
||||
|
||||
public function statusHistories(): HasMany
|
||||
{
|
||||
return $this->hasMany(ApplicationStatusHistory::class);
|
||||
}
|
||||
|
||||
public function staffAssignments(): HasMany
|
||||
{
|
||||
return $this->hasMany(StaffAssignment::class);
|
||||
}
|
||||
|
||||
public function bankVerification(): HasOne
|
||||
{
|
||||
return $this->hasOne(BankVerification::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user