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?
6 Replies
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 itselfActually, 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.
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 thinkif () {
$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
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