50 lines
1.1 KiB
PHP
50 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Models\Show;
|
|
|
|
use App\Filters\Show\ShowDaysFilters;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class ShowDays extends Model
|
|
{
|
|
|
|
protected $table = 'cc_show_days';
|
|
|
|
protected $fillable = [
|
|
'first_show',
|
|
'last_show',
|
|
'start_time',
|
|
'timezone',
|
|
'duration',
|
|
'day',
|
|
'repeat_type',
|
|
'next_pop_date',
|
|
'show_id',
|
|
'record',
|
|
];
|
|
|
|
protected $casts = [
|
|
'first_show' => 'date',
|
|
'last_show' => 'date',
|
|
'start_time' => 'datetime',
|
|
'timezone' => 'string',
|
|
'duration' => 'string',
|
|
'day' => 'int',
|
|
'repeat_type' => 'int',
|
|
'next_pop_date' => 'date',
|
|
'show_id' => 'int',
|
|
'record' => 'int'
|
|
];
|
|
|
|
public function show(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Show::class, 'show_id');
|
|
}
|
|
|
|
public function scopeSearchFilter($query, $request) {
|
|
$filters = new ShowDaysFilters();
|
|
return $filters->apply($query, $request);
|
|
}
|
|
}
|