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

atmaboy's avatar

Class name must be a valid object or a string error

Laravel Version: 6.9.0 Nova Version: 2.9.2 PHP Version: 7.3.10

After update nova to latest version error on

/vendor/laravel/nova/src/Nova.php224

return $resource::authorizedToViewAny($request)

ErrorException (E_ERROR)
Class name must be a valid object or a string (View: /var/www/cportal/data/www/mysite.com/vendor/laravel/nova/resources/views/layout.blade.php) (View: /var/www/cportal/data/www/mysite.com/vendor/laravel/nova/resources/views/layout.blade.php)
Previous exceptions
Class name must be a valid object or a string (View: /var/www/cportal/data/www/mysite.com/vendor/laravel/nova/resources/views/layout.blade.php) (0)
Class name must be a valid object or a string (0)

image

0 likes
11 replies
atmaboy's avatar

error on this function line 224

/var/www/cportal/data/www/mysite.com/vendor/laravel/nova/src/Nova.php

    public static function availableResources(Request $request)
    {
        return collect(static::$resources)->filter(function ($resource) use ($request) {
            return $resource::authorizedToViewAny($request) &&
                   $resource::availableForNavigation($request);
        })->all();
    }
atmaboy's avatar

i have this error with clean resources on fresh install

Nakov's avatar
Nakov
Best Answer
Level 73

@atmaboy what are the steps that you take afterwards, as I've just tried fresh install on Nova, the same versions as you did, and all seems correct so far?

atmaboy's avatar

reinstall everything, and now it works...

philwilliammee's avatar

how did you reinstall everything? I am installing via composer I removed the nova directory and reinstalled it via composer and I have the same error. The error started after composer update to v2.9.3

composer remove laravel/nova
composer require laravel/nova
php artisan nova:publish

error persists.

jhchong's avatar

i had to downgrade nova to 2.6.* for it to work... FYI, I had no problem running it locally, but I get this problem when hosting on a DigitalOcean droplet. PHP versions are identical

1 like
philwilliammee's avatar

@jhchong Thats the same thing for me working on local but not on production. Downgrading to 2.6.* worked. I am running the same version of php 7.2 on both machines (maybe different configurations?). I'm running a older version of laravel 5.8.

djilousp's avatar

I'm having the same issue , the thing is i'm having the issue only for some resources other resources are working just fine , i have php version 7.1.3 and an older version of laravel 5.8 , should i downgrade nova to 2.6.* ?

Please or to participate in this conversation.