feat: Cast MediaMonitoring channel to an enum and display it as a colored badge in the monitoring table.
This commit is contained in:
parent
a3f3842cc1
commit
3313f31048
@ -48,7 +48,9 @@ public static function configure(Table $table): Table
|
|||||||
TextColumn::make('channel')
|
TextColumn::make('channel')
|
||||||
->label('Kanal')
|
->label('Kanal')
|
||||||
->searchable()
|
->searchable()
|
||||||
->sortable(),
|
->sortable()
|
||||||
|
->badge()
|
||||||
|
->color(fn (Channel $state): string => $state->getColor()),
|
||||||
|
|
||||||
TextColumn::make('writter')
|
TextColumn::make('writter')
|
||||||
->label('Penulis')
|
->label('Penulis')
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
|
use App\Enums\Channel;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||||
@ -22,6 +23,7 @@ protected function casts(): array
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'release_date' => 'date',
|
'release_date' => 'date',
|
||||||
|
'channel' => Channel::class,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user