You've already forked Atomcms-edit
38 lines
793 B
PHP
Executable File
38 lines
793 B
PHP
Executable File
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Models\Concerns\BelongsToUser;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class RadioContestEntry extends Model
|
|
{
|
|
use BelongsToUser;
|
|
|
|
#[\Override]
|
|
protected $table = 'radio_contest_entries';
|
|
|
|
#[\Override]
|
|
protected $guarded = ['id', 'created_at', 'updated_at', 'user_id', 'contest_id'];
|
|
|
|
/** @var array<string, string> */
|
|
#[\Override]
|
|
protected $casts = [
|
|
'submitted_at' => 'datetime',
|
|
'is_winner' => 'boolean',
|
|
];
|
|
|
|
public function contest(): BelongsTo
|
|
{
|
|
return $this->belongsTo(RadioContest::class);
|
|
}
|
|
|
|
public function markAsWinner(): void
|
|
{
|
|
$this->update(['is_winner' => true]);
|
|
}
|
|
}
|