Make Table rows unclickable
Hello friends!
is there any way that I can avoid to make the table rows clickable?
currently when I click, it redirects to edit page.
I want to make it clickable based on conditions
9 Replies
Filament
Getting started - Table Builder - Filament
The elegant TALL stack table builder for Laravel artisans.
@toeknee_iom thanks for this
but should I include this in the resource file? on in the ListCampaigns?
for now it is not working! I am not getting this well
On the ListRecords(ListCampaigns) as it's a table function. Your IDE should show you available functions to override when typing a new function in the class.
can I include a condition in this @toeknee_iom ?
let's say if the $record->manager_id == Auth->user()->id that is when the row should be clickable?
yes, sorry I should have linked you above to
https://filamentphp.com/docs/2.x/tables/getting-started#record-urls
Filament
Getting started - Table Builder - Filament
The elegant TALL stack table builder for Laravel artisans.
essentially just use $record->manager_id == Auth->user()->id ? 'add the url function here' : null
so full code
should work
I am getting this Return value must be of type string, null returned
return fn (Campaign $record): string => Auth::user()->role->role !== Role::DISTRICT_MANAGER_ROLE ? null : (
$record->manager_id == Auth::user()->manager->id ? route('filament.resources.campaigns.edit', ['record' => $record]) : null
);
updated
Thank you so much @toeknee_iom
it is working now!