FilamentF
Filament3y ago
Abi

Show infolist conditionally based on user role

On the Admin Panel if a particular resource has an infolist instead of the View page, is there a way enable access to the infolist only for a specific user role?

Passing an empty array for an infolist doesn't help as the table rows of the resource is still clickable. Any way to disable row clicks based on user role as an alternative?
Solution
Personally instead of typing out the url, do this:
->recordUrl(fn($record) => auth()->user()->hasRole('CUSTOMER') ? null : self::getUrl('view', ['record' => $record]))
Was this page helpful?