You've already forked Atomcms-edit
Initial commit
This commit is contained in:
Executable
+61
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|RadioApplication where($column, $operator = null, $value = null)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|RadioApplication create($attributes = [])
|
||||
*/
|
||||
class RadioApplication extends Model
|
||||
{
|
||||
#[\Override]
|
||||
protected $table = 'radio_applications';
|
||||
|
||||
#[\Override]
|
||||
protected $guarded = ['id', 'created_at', 'updated_at', 'user_id', 'position_id', 'status'];
|
||||
|
||||
/** @var array<string, string> */
|
||||
#[\Override]
|
||||
protected $casts = [
|
||||
'approved_at' => 'datetime',
|
||||
'rejected_at' => 'datetime',
|
||||
];
|
||||
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'user_id');
|
||||
}
|
||||
|
||||
public function rank(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(RadioRank::class, 'rank_id');
|
||||
}
|
||||
|
||||
public function approver(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'approved_by');
|
||||
}
|
||||
|
||||
public function rejector(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'rejected_by');
|
||||
}
|
||||
|
||||
public function scopePending($query)
|
||||
{
|
||||
return $query->where('status', 'pending');
|
||||
}
|
||||
|
||||
public function scopeApproved($query)
|
||||
{
|
||||
return $query->where('status', 'approved');
|
||||
}
|
||||
|
||||
public function scopeRejected($query)
|
||||
{
|
||||
return $query->where('status', 'rejected');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user