refactor(theme): change label airing proof theme to theme only
This commit is contained in:
parent
e9513b7634
commit
6161126d9f
@ -1,23 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Master\AiringProofThemes\Pages;
|
||||
namespace App\Filament\Resources\Master\Themes\Pages;
|
||||
|
||||
use App\Filament\Resources\Master\AiringProofThemes\AiringProofThemeResource;
|
||||
use App\Filament\Resources\Master\Themes\ThemeResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ManageRecords;
|
||||
|
||||
class ManageAiringProofThemes extends ManageRecords
|
||||
class ManageThemes extends ManageRecords
|
||||
{
|
||||
protected static ?string $title = 'Tema Bukti Tayang';
|
||||
protected static ?string $title = 'Tema';
|
||||
|
||||
protected static string $resource = AiringProofThemeResource::class;
|
||||
protected static string $resource = ThemeResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make()
|
||||
->label('Tambah')
|
||||
->modalHeading('Tambah Tema Bukti Tayang')
|
||||
->modalHeading('Tambah Tema')
|
||||
->modalSubmitActionLabel('Simpan')
|
||||
->modalCancelActionLabel('Batal')
|
||||
->extraModalFooterActions(fn (CreateAction $action): array => [
|
||||
@ -1,12 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Master\AiringProofThemes;
|
||||
namespace App\Filament\Resources\Master\Themes;
|
||||
|
||||
use App\Enums\IsActive;
|
||||
use App\Filament\Actions\DefaultBulkActions;
|
||||
use App\Filament\Columns\TimestampColumns;
|
||||
use App\Filament\Resources\Master\AiringProofThemes\Pages\ManageAiringProofThemes;
|
||||
use App\Models\AiringProofTheme;
|
||||
use App\Filament\Resources\Master\Themes\Pages\ManageThemes;
|
||||
use App\Models\Theme;
|
||||
use BackedEnum;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteAction;
|
||||
@ -25,17 +25,17 @@
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use UnitEnum;
|
||||
|
||||
class AiringProofThemeResource extends Resource
|
||||
class ThemeResource extends Resource
|
||||
{
|
||||
protected static ?string $model = AiringProofTheme::class;
|
||||
protected static ?string $model = Theme::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::PuzzlePiece;
|
||||
|
||||
protected static ?string $navigationLabel = 'Tema Bukti Tayang';
|
||||
protected static ?string $navigationLabel = 'Tema';
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Master';
|
||||
|
||||
protected static ?string $slug = 'master/airing-proof-themes';
|
||||
protected static ?string $slug = 'master/themes';
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'name';
|
||||
|
||||
@ -68,8 +68,8 @@ public static function table(Table $table): Table
|
||||
|
||||
ToggleColumn::make('is_active')
|
||||
->label('Aktif?')
|
||||
->getStateUsing(fn (AiringProofTheme $record) => $record->is_active === IsActive::ACTIVE)
|
||||
->updateStateUsing(function (AiringProofTheme $record, bool $state) {
|
||||
->getStateUsing(fn (Theme $record) => $record->is_active === IsActive::ACTIVE)
|
||||
->updateStateUsing(function (Theme $record, bool $state) {
|
||||
$record->is_active = $state ? IsActive::ACTIVE : IsActive::INACTIVE;
|
||||
$record->save();
|
||||
})
|
||||
@ -88,7 +88,7 @@ public static function table(Table $table): Table
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
...DefaultBulkActions::make('Tema Bukti Tayang'),
|
||||
...DefaultBulkActions::make('Tema'),
|
||||
]),
|
||||
])
|
||||
->emptyStateIcon('heroicon-o-bookmark')
|
||||
@ -101,7 +101,7 @@ public static function table(Table $table): Table
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ManageAiringProofThemes::route('/'),
|
||||
'index' => ManageThemes::route('/'),
|
||||
];
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class AiringProofTheme extends Model
|
||||
class Theme extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
@ -1,69 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use App\Models\AiringProofTheme;
|
||||
use Illuminate\Auth\Access\HandlesAuthorization;
|
||||
use Illuminate\Foundation\Auth\User as AuthUser;
|
||||
|
||||
class AiringProofThemePolicy
|
||||
{
|
||||
use HandlesAuthorization;
|
||||
|
||||
public function viewAny(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('ViewAny:AiringProofTheme');
|
||||
}
|
||||
|
||||
public function view(AuthUser $authUser, AiringProofTheme $airingProofTheme): bool
|
||||
{
|
||||
return $authUser->can('View:AiringProofTheme');
|
||||
}
|
||||
|
||||
public function create(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('Create:AiringProofTheme');
|
||||
}
|
||||
|
||||
public function update(AuthUser $authUser, AiringProofTheme $airingProofTheme): bool
|
||||
{
|
||||
return $authUser->can('Update:AiringProofTheme');
|
||||
}
|
||||
|
||||
public function delete(AuthUser $authUser, AiringProofTheme $airingProofTheme): bool
|
||||
{
|
||||
return $authUser->can('Delete:AiringProofTheme');
|
||||
}
|
||||
|
||||
public function restore(AuthUser $authUser, AiringProofTheme $airingProofTheme): bool
|
||||
{
|
||||
return $authUser->can('Restore:AiringProofTheme');
|
||||
}
|
||||
|
||||
public function forceDelete(AuthUser $authUser, AiringProofTheme $airingProofTheme): bool
|
||||
{
|
||||
return $authUser->can('ForceDelete:AiringProofTheme');
|
||||
}
|
||||
|
||||
public function forceDeleteAny(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('ForceDeleteAny:AiringProofTheme');
|
||||
}
|
||||
|
||||
public function restoreAny(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('RestoreAny:AiringProofTheme');
|
||||
}
|
||||
|
||||
public function replicate(AuthUser $authUser, AiringProofTheme $airingProofTheme): bool
|
||||
{
|
||||
return $authUser->can('Replicate:AiringProofTheme');
|
||||
}
|
||||
|
||||
public function reorder(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('Reorder:AiringProofTheme');
|
||||
}
|
||||
}
|
||||
69
app/Policies/ThemePolicy.php
Normal file
69
app/Policies/ThemePolicy.php
Normal file
@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use App\Models\Theme;
|
||||
use Illuminate\Auth\Access\HandlesAuthorization;
|
||||
use Illuminate\Foundation\Auth\User as AuthUser;
|
||||
|
||||
class ThemePolicy
|
||||
{
|
||||
use HandlesAuthorization;
|
||||
|
||||
public function viewAny(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('ViewAny:Theme');
|
||||
}
|
||||
|
||||
public function view(AuthUser $authUser, Theme $theme): bool
|
||||
{
|
||||
return $authUser->can('View:Theme');
|
||||
}
|
||||
|
||||
public function create(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('Create:Theme');
|
||||
}
|
||||
|
||||
public function update(AuthUser $authUser, Theme $theme): bool
|
||||
{
|
||||
return $authUser->can('Update:Theme');
|
||||
}
|
||||
|
||||
public function delete(AuthUser $authUser, Theme $theme): bool
|
||||
{
|
||||
return $authUser->can('Delete:Theme');
|
||||
}
|
||||
|
||||
public function restore(AuthUser $authUser, Theme $theme): bool
|
||||
{
|
||||
return $authUser->can('Restore:Theme');
|
||||
}
|
||||
|
||||
public function forceDelete(AuthUser $authUser, Theme $theme): bool
|
||||
{
|
||||
return $authUser->can('ForceDelete:Theme');
|
||||
}
|
||||
|
||||
public function forceDeleteAny(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('ForceDeleteAny:Theme');
|
||||
}
|
||||
|
||||
public function restoreAny(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('RestoreAny:Theme');
|
||||
}
|
||||
|
||||
public function replicate(AuthUser $authUser, Theme $theme): bool
|
||||
{
|
||||
return $authUser->can('Replicate:Theme');
|
||||
}
|
||||
|
||||
public function reorder(AuthUser $authUser): bool
|
||||
{
|
||||
return $authUser->can('Reorder:Theme');
|
||||
}
|
||||
}
|
||||
@ -12,7 +12,7 @@
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('airing_proof_themes', function (Blueprint $table) {
|
||||
Schema::create('themes', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name', 50);
|
||||
$table->enum('is_active', [IsActive::values()])->default(IsActive::ACTIVE->value)->comment(IsActive::comment());
|
||||
@ -28,6 +28,6 @@ public function up(): void
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('airing_proof_themes');
|
||||
Schema::dropIfExists('themes');
|
||||
}
|
||||
};
|
||||
@ -29,17 +29,17 @@ public function run(): void
|
||||
"RestoreAny:Role",
|
||||
"Replicate:Role",
|
||||
"Reorder:Role",
|
||||
"ViewAny:AiringProofTheme",
|
||||
"View:AiringProofTheme",
|
||||
"Create:AiringProofTheme",
|
||||
"Update:AiringProofTheme",
|
||||
"Delete:AiringProofTheme",
|
||||
"Restore:AiringProofTheme",
|
||||
"ForceDelete:AiringProofTheme",
|
||||
"ForceDeleteAny:AiringProofTheme",
|
||||
"RestoreAny:AiringProofTheme",
|
||||
"Replicate:AiringProofTheme",
|
||||
"Reorder:AiringProofTheme",
|
||||
"ViewAny:Theme",
|
||||
"View:Theme",
|
||||
"Create:Theme",
|
||||
"Update:Theme",
|
||||
"Delete:Theme",
|
||||
"Restore:Theme",
|
||||
"ForceDelete:Theme",
|
||||
"ForceDeleteAny:Theme",
|
||||
"RestoreAny:Theme",
|
||||
"Replicate:Theme",
|
||||
"Reorder:Theme",
|
||||
"ViewAny:Classification",
|
||||
"View:Classification",
|
||||
"Create:Classification",
|
||||
@ -112,17 +112,17 @@ public function run(): void
|
||||
"name": "Administrator",
|
||||
"guard_name": "web",
|
||||
"permissions": [
|
||||
"ViewAny:AiringProofTheme",
|
||||
"View:AiringProofTheme",
|
||||
"Create:AiringProofTheme",
|
||||
"Update:AiringProofTheme",
|
||||
"Delete:AiringProofTheme",
|
||||
"Restore:AiringProofTheme",
|
||||
"ForceDelete:AiringProofTheme",
|
||||
"ForceDeleteAny:AiringProofTheme",
|
||||
"RestoreAny:AiringProofTheme",
|
||||
"Replicate:AiringProofTheme",
|
||||
"Reorder:AiringProofTheme",
|
||||
"ViewAny:Theme",
|
||||
"View:Theme",
|
||||
"Create:Theme",
|
||||
"Update:Theme",
|
||||
"Delete:Theme",
|
||||
"Restore:Theme",
|
||||
"ForceDelete:Theme",
|
||||
"ForceDeleteAny:Theme",
|
||||
"RestoreAny:Theme",
|
||||
"Replicate:Theme",
|
||||
"Reorder:Theme",
|
||||
"ViewAny:Classification",
|
||||
"View:Classification",
|
||||
"Create:Classification",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user