78 lines
1.9 KiB
PHP
78 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace App\Models\Show;
|
|
|
|
use App\Models\Playlist;
|
|
use App\Models\ShowInstances\ShowInstances;
|
|
use App\Models\SmartBlock;
|
|
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\SoftDeletes;
|
|
|
|
class Show extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $table = 'cc_show';
|
|
|
|
protected $fillable = [
|
|
'name',
|
|
'url',
|
|
'genre',
|
|
'description',
|
|
'color',
|
|
'background_color',
|
|
'live_stream_using_airtime_auth',
|
|
'live_stream_using_custom_auth',
|
|
'live_stream_user',
|
|
'live_stream_pass',
|
|
'linked',
|
|
'is_linkable',
|
|
'image_path',
|
|
'has_autoplaylist',
|
|
'autoplaylist_id',
|
|
'autoplaylist_repeat',
|
|
];
|
|
|
|
protected $casts = [
|
|
'live_stream_using_airtime_auth' => 'boolean',
|
|
'live_stream_using_custom_auth' => 'boolean',
|
|
'linked' => 'boolean',
|
|
'is_linkable' => 'boolean',
|
|
'has_autoplaylist' => 'boolean',
|
|
'autoplaylist_repeat' => 'boolean',
|
|
];
|
|
|
|
|
|
public function block(): BelongsTo
|
|
{
|
|
return $this->belongsTo(SmartBlock::class, 'autoplaylist_id');
|
|
}
|
|
|
|
public function showDays()
|
|
{
|
|
return $this->hasMany(ShowDays::class, 'show_id');
|
|
}
|
|
|
|
public function showDjs()
|
|
{
|
|
return $this->hasMany(ShowHosts::class, 'show_id');
|
|
}
|
|
|
|
public function showInstances()
|
|
{
|
|
return $this->hasMany(ShowInstances::class, 'show_id');
|
|
}
|
|
|
|
public function scopeSearchFilter($query, $filters)
|
|
{
|
|
return $filters->apply($query);
|
|
}
|
|
|
|
public function playlist()
|
|
{
|
|
return $this->belongsTo(Playlist::class, 'autoplaylist_id', 'id');
|
|
}
|
|
}
|