Voyager: ErrorException (E_ERROR) get_class() expects parameter 1 to be object, string given

Created on 9 Sep 2019  路  11Comments  路  Source: the-control-group/voyager

Version information

Description


ErrorException (E_ERROR)
get_class() expects parameter 1 to be object, string given (View: /home/u535562063/domains/najdeh-system.com/vendor/tcg/voyager/resources/views/bread/partials/actions.blade.php) (View: /home/u535562063/domains/najdeh-system.com/vendor/tcg/voyager/resources/views/bread/partials/actions.blade.php)
Previous exceptions
get_class() expects parameter 1 to be object, string given (View: /home/u535562063/domains/najdeh-system.com/vendor/tcg/voyager/resources/views/bread/partials/actions.blade.php) (0)
get_class() expects parameter 1 to be object, string given (0)

Additional context

right after upgrading to 1.2.7

possible bug

Most helpful comment

For anyone suddenly suffering from this...

This is absolutely related to upgrading from 1.2.6 to 1.2.7. But, it is more specifically related to using a 1.2.6 bread/browse.blade.php view on top of a 1.2.7 voyager core. This describes my situation, and it describes the OP's situation.

It also seems to interplay with cache (maybe view cache), so you may not see this right after an upgrade. It may pop up some time later, seemingly out of the blue when your cache happens to refresh...

Your solution is not to downgrade to 1.2.6: it is to upgrade your custom browse.blade.php to the 1.2.7 version 馃巿Diff it with your customized version, and I bet you'll find that your version uses Voyager::actions() (bad) instead of the new $actions (馃帀). For me, this was lines 32 & 257

All 11 comments

We need a little more information.
This doesn't happen on a default installation. So do you have custom Actions? If yes, how do they look?
Can you post a screenshot of the stacktrace?

this error happens where i use a custom view nothing fancy i just added a new table in the browse the action.blade is reading from this table .. in the past it worked great after update this happened as for the table it has the same action buttons as the default table

i downgraded voyager to 1.2.6 for now till i find a solution to the problem thanks

i downgraded voyager to 1.2.6 for now till i find a solution to the problem thanks

I solved it in the same way.thank you.
In my case, it happens only user table.

Also getting this error. I'm using Laravel Wave that relies on voyager. Only package I can think of that might be having conflicts with at the moment.

For anyone suddenly suffering from this...

This is absolutely related to upgrading from 1.2.6 to 1.2.7. But, it is more specifically related to using a 1.2.6 bread/browse.blade.php view on top of a 1.2.7 voyager core. This describes my situation, and it describes the OP's situation.

It also seems to interplay with cache (maybe view cache), so you may not see this right after an upgrade. It may pop up some time later, seemingly out of the blue when your cache happens to refresh...

Your solution is not to downgrade to 1.2.6: it is to upgrade your custom browse.blade.php to the 1.2.7 version 馃巿Diff it with your customized version, and I bet you'll find that your version uses Voyager::actions() (bad) instead of the new $actions (馃帀). For me, this was lines 32 & 257

@insology this is a closed issue, did you read previous comments?

@MrCrayon , yes but i confused actions.blade with browse.blade.php :(

Hi, i'm having the same issue, just been updating an app i wasnt updating since a couple of years.

I am using custom views and thats the first thing i update once i update the app but to debug this issue i have removed all the custom views, and still have the issue, so really no clue where this is coming from.

Tried to downgrade but nothing changed.
Tried to delete all caches, views and what so ever but nothing changed.

Im currently on 1.3.2

If i do a grep like : grep -R "Voyager::actions" *

I get the following.

_resources/views/vendor/voyager/actions/browse.blade.php_: @foreach(Voyager::actions() as $action)

_resources/views/vendor/voyager/submission-forms-entries/browse.blade.php_: @foreach(Voyager::actions() as $action)

_storage/framework/views/dc188e9091367cd620e987dccb956c98ac3fd6c0.php_: addLoop($__currentLoopData); foreach($__currentLoopData as $action): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>

_vendor/pvtl/voyager-frontend/resources/views/vendor/voyager/users/browse.blade.php_: @foreach(Voyager::actions() as $action)

_vendor/tcg/voyager/src/Http/Controllers/VoyagerBaseController.php_: foreach (Voyager::actions() as $action) {

Please note that i have updated all the browse.blade.php except the first two ones you see up here, if i update these two with Voyager::actions()-> $actions, it gives exception:

Undefined variable: actions

The weird thing is that this is happening only on these two templates, all the others has been updated correctly and works with no issues with $actions.

As well weird thing that this "vendor/tcg/voyager/src/Http/Controllers/VoyagerBaseController.php" is not updated for what i see on the grep.

Somebody has any idea on how to figure this out?

@tommiekn this is a closed issue.
Read previous comments https://github.com/the-control-group/voyager/issues/4398#issuecomment-537762684 and if you have problems upgrading please ask in Voyager slack chat.

This issue has been automatically locked since there has not been any recent activity after it was closed. If you have further questions please ask in our Slack group.

Was this page helpful?
0 / 5 - 0 ratings