CerealKiller
CerealKiller
FFilament
Created by CerealKiller on 4/17/2024 in #❓┊help
Tabs and Bulk Actions sync
Ok, cool thank you, I knew I was close.
4 replies
FFilament
Created by shashika on 2/16/2024 in #❓┊help
How to override filament default form data store method
Is missing
14 replies
FFilament
Created by shashika on 2/16/2024 in #❓┊help
How to override filament default form data store method
parent::__construct();
parent::__construct();
14 replies
FFilament
Created by BBB on 2/18/2024 in #❓┊help
Database notification translation
@BBB you can publish vendor translations for filament notifications as well 🙂
3 replies
FFilament
Created by CerealKiller on 2/18/2024 in #❓┊help
How to override list resource table query?
But I am getting
Cannot use "::class" on null {"userId":1,"exception":"[object] (TypeError(code: 0): Cannot use \"::class\" on null at /var/www/html/vendor/filament/tables/src/Table/Concerns/HasRecords.php:76)
Cannot use "::class" on null {"userId":1,"exception":"[object] (TypeError(code: 0): Cannot use \"::class\" on null at /var/www/html/vendor/filament/tables/src/Table/Concerns/HasRecords.php:76)
4 replies
FFilament
Created by CerealKiller on 2/18/2024 in #❓┊help
How to override list resource table query?
This is the code I'm trying to implement:
$user = auth()->user();

$t = parent::table($table);

$t->modifyQueryUsing(function (Builder $q) use ($user) {
return match ($user->roles->first->name) {
Role::SuperAdmin->value, Role::CompanyManager->value => $q->orderBy('time', 'ASC')
->whereNull('super_admin_confirmed_at'),
Role::Admin->value => $q->orderBy('time', 'ASC'),
Role::Driver->value => $q
->where('status', '<>', DriveStatus::Canceled->value)
->where('user_id', '=', $user->id)
->whereNull('confirmed_at')
->orderBy('time', 'ASC'),
default => $q,
};
});

return $t;
$user = auth()->user();

$t = parent::table($table);

$t->modifyQueryUsing(function (Builder $q) use ($user) {
return match ($user->roles->first->name) {
Role::SuperAdmin->value, Role::CompanyManager->value => $q->orderBy('time', 'ASC')
->whereNull('super_admin_confirmed_at'),
Role::Admin->value => $q->orderBy('time', 'ASC'),
Role::Driver->value => $q
->where('status', '<>', DriveStatus::Canceled->value)
->where('user_id', '=', $user->id)
->whereNull('confirmed_at')
->orderBy('time', 'ASC'),
default => $q,
};
});

return $t;
4 replies