style: Standardize arrow function spacing and apply minor formatting adjustments across several Filament resources.

This commit is contained in:
Yoga Pangestu 2026-01-27 21:05:00 +07:00
parent a847b6e1fc
commit 394525bcc2
9 changed files with 28 additions and 28 deletions

View File

@ -104,7 +104,7 @@ public static function infolist(Schema $schema): Schema
->placeholder('Belum dibalas'), ->placeholder('Belum dibalas'),
]) ])
->columnSpanFull() ->columnSpanFull()
->visible(fn(Contact $record): bool => $record->replied_at !== null), ->visible(fn (Contact $record): bool => $record->replied_at !== null),
]) ])
->columns(2); ->columns(2);
} }
@ -128,7 +128,7 @@ public static function table(Table $table): Table
IconColumn::make('replied_at') IconColumn::make('replied_at')
->label('Dibalas') ->label('Dibalas')
->boolean() ->boolean()
->getStateUsing(fn(Contact $record): bool => $record->replied_at !== null), ->getStateUsing(fn (Contact $record): bool => $record->replied_at !== null),
TextColumn::make('repliedBy.name') TextColumn::make('repliedBy.name')
->label('Dibalas Oleh') ->label('Dibalas Oleh')
@ -157,7 +157,7 @@ public static function table(Table $table): Table
->schema([ ->schema([
Textarea::make('reply_message') Textarea::make('reply_message')
->label('Pesan Balasan') ->label('Pesan Balasan')
->placeholder(fn(Contact $record): string => "Halo {$record->name}, ...") ->placeholder(fn (Contact $record): string => "Halo {$record->name}, ...")
->required() ->required()
->rows(5) ->rows(5)
->autocomplete(false) ->autocomplete(false)
@ -177,7 +177,7 @@ public static function table(Table $table): Table
'Pesan balasan Anda sudah meluncur ke email pengirim. Semoga membantu mereka ya! 😊' 'Pesan balasan Anda sudah meluncur ke email pengirim. Semoga membantu mereka ya! 😊'
)->send(); )->send();
}) })
->visible(fn(Contact $record): bool => $record->replied_at === null), ->visible(fn (Contact $record): bool => $record->replied_at === null),
DeleteAction::make() DeleteAction::make()
->label('Hapus'), ->label('Hapus'),

View File

@ -37,7 +37,7 @@ protected function getHeaderActions(): array
->modalHeading('Tambah Jurnalis') ->modalHeading('Tambah Jurnalis')
->modalSubmitActionLabel('Simpan') ->modalSubmitActionLabel('Simpan')
->modalCancelActionLabel('Batal') ->modalCancelActionLabel('Batal')
->extraModalFooterActions(fn(CreateAction $action): array => [ ->extraModalFooterActions(fn (CreateAction $action): array => [
$action->makeModalSubmitAction('createAnother', arguments: ['another' => true]) $action->makeModalSubmitAction('createAnother', arguments: ['another' => true])
->label('Simpan dan Tambah Lagi'), ->label('Simpan dan Tambah Lagi'),
]) ])

View File

@ -10,7 +10,7 @@
class ManageClassifications extends ManageRecords class ManageClassifications extends ManageRecords
{ {
protected static string $resource = ClassificationResource::class; protected static string $resource = ClassificationResource::class;
protected static ?string $title = 'Klasifikasi'; protected static ?string $title = 'Klasifikasi';
protected function getHeaderActions(): array protected function getHeaderActions(): array

View File

@ -21,7 +21,7 @@ protected function getHeaderActions(): array
->modalHeading('Tambah OPD') ->modalHeading('Tambah OPD')
->modalSubmitActionLabel('Simpan') ->modalSubmitActionLabel('Simpan')
->modalCancelActionLabel('Batal') ->modalCancelActionLabel('Batal')
->extraModalFooterActions(fn(CreateAction $action): array => [ ->extraModalFooterActions(fn (CreateAction $action): array => [
$action->makeModalSubmitAction('createAnother', arguments: ['another' => true]) $action->makeModalSubmitAction('createAnother', arguments: ['another' => true])
->label('Simpan dan Tambah Lagi'), ->label('Simpan dan Tambah Lagi'),
]) ])

View File

@ -21,7 +21,7 @@ protected function getHeaderActions(): array
->modalHeading('Tambah Lokasi') ->modalHeading('Tambah Lokasi')
->modalSubmitActionLabel('Simpan') ->modalSubmitActionLabel('Simpan')
->modalCancelActionLabel('Batal') ->modalCancelActionLabel('Batal')
->extraModalFooterActions(fn(CreateAction $action): array => [ ->extraModalFooterActions(fn (CreateAction $action): array => [
$action->makeModalSubmitAction('createAnother', arguments: ['another' => true]) $action->makeModalSubmitAction('createAnother', arguments: ['another' => true])
->label('Simpan dan Tambah Lagi'), ->label('Simpan dan Tambah Lagi'),
]) ])

View File

@ -21,7 +21,7 @@ protected function getHeaderActions(): array
->modalHeading('Tambah Tema') ->modalHeading('Tambah Tema')
->modalSubmitActionLabel('Simpan') ->modalSubmitActionLabel('Simpan')
->modalCancelActionLabel('Batal') ->modalCancelActionLabel('Batal')
->extraModalFooterActions(fn(CreateAction $action): array => [ ->extraModalFooterActions(fn (CreateAction $action): array => [
$action->makeModalSubmitAction('createAnother', arguments: ['another' => true]) $action->makeModalSubmitAction('createAnother', arguments: ['another' => true])
->label('Simpan dan Tambah Lagi'), ->label('Simpan dan Tambah Lagi'),
]) ])

View File

@ -9,11 +9,12 @@
use App\Filament\Actions\Cheerful\ForceDeleteAction; use App\Filament\Actions\Cheerful\ForceDeleteAction;
use App\Filament\Actions\Cheerful\RestoreAction; use App\Filament\Actions\Cheerful\RestoreAction;
use App\Filament\Actions\DefaultBulkActions; use App\Filament\Actions\DefaultBulkActions;
use App\Filament\Support\CheerfulNotification;
use App\Filament\Columns\TimestampColumns; use App\Filament\Columns\TimestampColumns;
use App\Filament\Resources\Master\Users\Pages\ManageUsers; use App\Filament\Resources\Master\Users\Pages\ManageUsers;
use App\Filament\Support\CheerfulNotification;
use App\Models\User; use App\Models\User;
use BackedEnum; use BackedEnum;
use Filament\Actions\Action;
use Filament\Actions\BulkActionGroup; use Filament\Actions\BulkActionGroup;
use Filament\Forms\Components\Hidden; use Filament\Forms\Components\Hidden;
use Filament\Forms\Components\Select; use Filament\Forms\Components\Select;
@ -32,7 +33,6 @@
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\Hash;
use UnitEnum; use UnitEnum;
use Filament\Actions\Action;
class UserResource extends Resource class UserResource extends Resource
{ {
@ -90,7 +90,7 @@ public static function form(Schema $schema): Schema
->searchable(), ->searchable(),
Hidden::make('password') Hidden::make('password')
->default(fn(?User $record): ?string => $record ? null : config('auth.password_default')), ->default(fn (?User $record): ?string => $record ? null : config('auth.password_default')),
]) ])
->columns(1); ->columns(1);
} }
@ -117,7 +117,7 @@ public static function table(Table $table): Table
ToggleColumn::make('is_active') ToggleColumn::make('is_active')
->label('Status') ->label('Status')
->sortable() ->sortable()
->getStateUsing(fn(User $record): bool => $record->is_active === IsActive::ACTIVE) ->getStateUsing(fn (User $record): bool => $record->is_active === IsActive::ACTIVE)
->updateStateUsing(function (User $record, bool $state): void { ->updateStateUsing(function (User $record, bool $state): void {
$record->is_active = $state ? IsActive::ACTIVE : IsActive::INACTIVE; $record->is_active = $state ? IsActive::ACTIVE : IsActive::INACTIVE;
$record->save(); $record->save();
@ -134,35 +134,35 @@ public static function table(Table $table): Table
->success() ->success()
->send(); ->send();
}) })
->disabled(fn(User $record): bool => $record->hasRole(RoleEnum::PERUSAHAAN->value)), ->disabled(fn (User $record): bool => $record->hasRole(RoleEnum::PERUSAHAAN->value)),
TextColumn::make('roles.name') TextColumn::make('roles.name')
->label('Peran') ->label('Peran')
->searchable() ->searchable()
->sortable() ->sortable()
->badge() ->badge()
->getStateUsing(fn(User $record): array => $record->roles->pluck('name', 'id')->toArray()), ->getStateUsing(fn (User $record): array => $record->roles->pluck('name', 'id')->toArray()),
...TimestampColumns::make(), ...TimestampColumns::make(),
]) ])
->filters([ ->filters([
TrashedFilter::make() TrashedFilter::make()
->native(false) ->native(false)
->visible(fn() => auth()->user()?->hasRole('Developer')), ->visible(fn () => auth()->user()?->hasRole('Developer')),
]) ])
->recordActions([ ->recordActions([
EditAction::make() EditAction::make()
->modalWidth(Width::Large) ->modalWidth(Width::Large)
->hidden(fn(User $record): bool => $record->hasRole(RoleEnum::PERUSAHAAN->value)), ->hidden(fn (User $record): bool => $record->hasRole(RoleEnum::PERUSAHAAN->value)),
DeleteAction::make() DeleteAction::make()
->hidden(fn(User $record): bool => $record->hasRole(RoleEnum::PERUSAHAAN->value)), ->hidden(fn (User $record): bool => $record->hasRole(RoleEnum::PERUSAHAAN->value)),
ForceDeleteAction::make() ForceDeleteAction::make()
->hidden(fn(User $record): bool => $record->hasRole(RoleEnum::PERUSAHAAN->value)), ->hidden(fn (User $record): bool => $record->hasRole(RoleEnum::PERUSAHAAN->value)),
RestoreAction::make() RestoreAction::make()
->hidden(fn(User $record): bool => $record->hasRole(RoleEnum::PERUSAHAAN->value)), ->hidden(fn (User $record): bool => $record->hasRole(RoleEnum::PERUSAHAAN->value)),
Action::make('resetPassword') Action::make('resetPassword')
->label('Ganti Kata Sandi') ->label('Ganti Kata Sandi')
@ -187,7 +187,7 @@ public static function table(Table $table): Table
"Kata sandi untuk pengguna {$record->name} telah diperbarui." "Kata sandi untuk pengguna {$record->name} telah diperbarui."
)->send(); )->send();
}) })
->hidden(fn(User $record): bool => $record->hasRole(RoleEnum::PERUSAHAAN->value)), ->hidden(fn (User $record): bool => $record->hasRole(RoleEnum::PERUSAHAAN->value)),
]) ])
->toolbarActions([ ->toolbarActions([
BulkActionGroup::make([ BulkActionGroup::make([

View File

@ -75,16 +75,16 @@ public static function form(Schema $schema): Schema
CheckboxList::make('partnerMedia') CheckboxList::make('partnerMedia')
->label('Kirim Kepada') ->label('Kirim Kepada')
->relationship('partnerMedia', 'name', fn(Builder $query): Builder => $query->verified()) ->relationship('partnerMedia', 'name', fn (Builder $query): Builder => $query->verified())
->visible(fn(Get $get): bool => in_array($get('type'), [AnnouncementType::COMPANY, AnnouncementType::COMPANY->value])) ->visible(fn (Get $get): bool => in_array($get('type'), [AnnouncementType::COMPANY, AnnouncementType::COMPANY->value]))
->required(fn(Get $get): bool => in_array($get('type'), [AnnouncementType::COMPANY, AnnouncementType::COMPANY->value])) ->required(fn (Get $get): bool => in_array($get('type'), [AnnouncementType::COMPANY, AnnouncementType::COMPANY->value]))
->searchable() ->searchable()
->noSearchResultsMessage('Tidak ada media yang ditemukan.') ->noSearchResultsMessage('Tidak ada media yang ditemukan.')
->helperText('Pilih media yang akan menerima pengumuman ini') ->helperText('Pilih media yang akan menerima pengumuman ini')
->columnSpanFull() ->columnSpanFull()
->bulkToggleable() ->bulkToggleable()
->selectAllAction( ->selectAllAction(
fn(Action $action): Action => $action->label('Pilih Semua Media'), fn (Action $action): Action => $action->label('Pilih Semua Media'),
) )
->dehydrated(), ->dehydrated(),
@ -121,7 +121,7 @@ public static function table(Table $table): Table
->listWithLineBreaks() ->listWithLineBreaks()
->limitList(3) ->limitList(3)
->expandableLimitedList() ->expandableLimitedList()
->placeholder(fn(Announcement $record): string => $record->type === AnnouncementType::PUBLIC ? 'Publik' : 'Tidak ada penerima'), ->placeholder(fn (Announcement $record): string => $record->type === AnnouncementType::PUBLIC ? 'Publik' : 'Tidak ada penerima'),
...TimestampColumns::make(), ...TimestampColumns::make(),
]) ])
@ -131,7 +131,7 @@ public static function table(Table $table): Table
->recordActions([ ->recordActions([
EditAction::make() EditAction::make()
->modalWidth(Width::TwoExtraLarge) ->modalWidth(Width::TwoExtraLarge)
->visible(fn(Announcement $record): bool => $record->type === AnnouncementType::PUBLIC), ->visible(fn (Announcement $record): bool => $record->type === AnnouncementType::PUBLIC),
DeleteAction::make(), DeleteAction::make(),

View File

@ -26,7 +26,7 @@ protected function getHeaderActions(): array
->modalHeading('Tambah Pengumuman') ->modalHeading('Tambah Pengumuman')
->modalSubmitActionLabel('Simpan') ->modalSubmitActionLabel('Simpan')
->modalCancelActionLabel('Batal') ->modalCancelActionLabel('Batal')
->extraModalFooterActions(fn(CreateAction $action): array => [ ->extraModalFooterActions(fn (CreateAction $action): array => [
$action->makeModalSubmitAction('createAnother', arguments: ['another' => true]) $action->makeModalSubmitAction('createAnother', arguments: ['another' => true])
->label('Simpan dan Tambah Lagi'), ->label('Simpan dan Tambah Lagi'),
]) ])