Call to a member function authorizedToSee() on boolean
I am trying to show the actions within the table. So in my resource i define my action with:
public function actions(Request $request)
{
return [
(new ChangeStatus)->shownOnTableRow()
];
}
But then i am getting the error Call to a member function authorizedToSee() on boolean. I am also using Policies, but the admin is able to see everything.
@nakov If you say "within the action" - Where do you actually mean? In my action i have the handle and fields method. Or do i need to create a new field for my index resource? I'm not sure, because the docs are not really clear about that.
new ChangeStatus works yes, but i can't call the showOnTableRow() method on that, so i thought maybe(new ChangeStatus)->shownOnTableRow()` is the way to go - which is obviously not :)
you cannot use shownOnTableRow
cause it will return boolean thats why you have an error on authorizedToSee
have to use showOnTableRow this will return the action and apply it to authorizedToSee
or you could add
Came across the same issue. Your execution is correct - it should be like on your first post but instead showOnTableRow() you have shownOnTableRow(). In my case phpstorm automatically proposed shown and I was surprised it's working on one resource (copied from Nova Doc) and not when I typed it (with help? of phpstorm).