Can I turn off the editing and viewing section subject to a condition?

translate_status==true If the translate_status status is true, can I turn off the viewing and editing section specifically for that column?
No description
6 Replies
Dennis Koch
Dennis Koch14mo ago
With "section" do you mean the Actions that lead to the Edit/Create page? You can hide them via Policies. And also hide them via ->hidden() on the Action itself
Mehmet K.
Mehmet K.OP14mo ago
Actually, what I mean exactly is that this place will remain active, but I don't want it to appear only for those whose status is true.
Mehmet K.
Mehmet K.OP14mo ago
No description
Dennis Koch
Dennis Koch14mo ago
Yeah, same concept. Use ->hidden() to only hide the button (you can use it with a condition). Users can still visit the page though. That's why I suggested Policies. Or also block the pages via the can... methods on the page level I think
Mehmet K.
Mehmet K.OP14mo ago
if () { $headerActions = [ Tables\Actions\EditAction::make(), ]; } I want to write a condition here, as I said, like show if $translate_status==false, but how will I access the records while I am here
No description
Dennis Koch
Dennis Koch14mo ago
That's not how it works. That's why I told you to use ->hidden() Also check this section which is also valid here: https://filamentphp.com/docs/3.x/forms/advanced#form-component-utility-injection
Want results from more Discord servers?
Add your server