Changed channel categories from DB-backed Category records to a backed PHP enum
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\ChannelCategory;
|
||||
use Database\Factories\ChannelFactory;
|
||||
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
@@ -12,7 +13,7 @@ use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
|
||||
#[Fillable([
|
||||
'user_id',
|
||||
'category_id',
|
||||
'category',
|
||||
'live_broadcast_id',
|
||||
'slug',
|
||||
'display_name',
|
||||
@@ -32,6 +33,7 @@ class Channel extends Model
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'category' => ChannelCategory::class,
|
||||
'is_live' => 'boolean',
|
||||
'viewer_count' => 'integer',
|
||||
'suspended_at' => 'datetime',
|
||||
@@ -48,11 +50,6 @@ class Channel extends Model
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function category(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Category::class);
|
||||
}
|
||||
|
||||
public function streamKey(): HasOne
|
||||
{
|
||||
return $this->hasOne(StreamKey::class);
|
||||
|
||||
Reference in New Issue
Block a user