Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

christopher's avatar

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.

Does anyone knows what i am doing wrong here?

0 likes
7 replies
Nakov's avatar

@christopher I believe that this shownOnTableRow returns a boolean while it needs to return just an object.

public function actions(Request $request)
{
    return [
        new ChangeStatus
    ];
}

So then within the action you will use the shownOnTableRow() method in order to display or not the action.

Or just make sure that from your shownOnTableRow() method you return the Action instance.

christopher's avatar

@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 :)

anditsung's avatar
Level 1

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

public $showOnTableRow = true;

to your action class

MrMister's avatar

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).

1 like
DavidPetrov's avatar

Dude, I ran into the exact same situation... wasted good an hour wondering what was going wrong! Thank you!

Please or to participate in this conversation.