fix: Filament v5 callbacks $r → $record (Plans/Subs/SuperAdmins/Companies)
+ central PWA: real PNG icons, SW registration, scope=/
- All `fn ($r) =>` and `fn (Type $r) =>` replaced with $record (Filament v5
injects callback params by name; $r resolved to nothing)
- /pwa/admin-{192,512}.png — generated on-the-fly with GD + DejaVuSans-Bold
- /pwa/admin-icon.svg — vector favicon
- /admin-sw.js — service worker (cache shell, network-first elsewhere)
with Service-Worker-Allowed: / header
- Manifest scope=/ + start_url=/admin → install prompt fires on Chrome/Edge/Safari
- BODY_END render hook registers SW on central panel
This commit is contained in:
@@ -93,7 +93,7 @@ class SuperAdminResource extends Resource
|
||||
Tables\Columns\IconColumn::make('app_authentication_secret')
|
||||
->label('2FA')
|
||||
->boolean()
|
||||
->getStateUsing(fn ($r) => $r->app_authentication_secret !== null)
|
||||
->getStateUsing(fn ($record) => $record?->app_authentication_secret !== null)
|
||||
->trueIcon('heroicon-o-lock-closed')
|
||||
->falseIcon('heroicon-o-lock-open')
|
||||
->trueColor('success')
|
||||
@@ -114,18 +114,18 @@ class SuperAdminResource extends Resource
|
||||
Forms\Components\TextInput::make('new_password')
|
||||
->password()->required()->minLength(8)->revealable(),
|
||||
])
|
||||
->action(function (SuperAdmin $r, array $data) {
|
||||
$r->update(['password' => Hash::make($data['new_password'])]);
|
||||
->action(function (SuperAdmin $record, array $data) {
|
||||
$record->update(['password' => Hash::make($data['new_password'])]);
|
||||
Notification::make()->title('Parolă resetată.')->success()->send();
|
||||
}),
|
||||
Actions\Action::make('toggle_2fa')
|
||||
->label(fn ($r) => $r->app_authentication_secret ? 'Dezactivează 2FA' : 'Forțează re-setare 2FA')
|
||||
->label(fn (SuperAdmin $record) => $record->app_authentication_secret ? 'Dezactivează 2FA' : 'Forțează re-setare 2FA')
|
||||
->icon('heroicon-m-lock-open')
|
||||
->color('danger')
|
||||
->visible(fn ($r) => $r->app_authentication_secret !== null)
|
||||
->visible(fn (SuperAdmin $record) => $record->app_authentication_secret !== null)
|
||||
->requiresConfirmation()
|
||||
->action(function (SuperAdmin $r) {
|
||||
$r->forceFill([
|
||||
->action(function (SuperAdmin $record) {
|
||||
$record->forceFill([
|
||||
'app_authentication_secret' => null,
|
||||
'app_authentication_recovery_codes' => null,
|
||||
'email_authentication_at' => null,
|
||||
@@ -134,8 +134,8 @@ class SuperAdminResource extends Resource
|
||||
}),
|
||||
Actions\EditAction::make(),
|
||||
Actions\DeleteAction::make()
|
||||
->before(function (SuperAdmin $r) {
|
||||
if (auth('central')->id() === $r->id) {
|
||||
->before(function (SuperAdmin $record) {
|
||||
if (auth('central')->id() === $record->id) {
|
||||
Notification::make()->title('Nu te poți șterge pe tine!')->danger()->send();
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user