arsenaltech / nova-tab

Laravel Nova Tabs
74 stars 17 forks source link

Class name must be a valid object or a string #1

Closed BrandDogs closed 5 years ago

BrandDogs commented 6 years ago

Hi,

Im getting the fllowing error on using this package.

Class name must be a valid object or a string {"userId":1,"email":"jurn@xx.nl","exception":"[object] (Symfony\Component\Debug\Exception\FatalThrowableError(code: 0): Class name must be a valid object or a string at /home/jurn/Documenten/sites/planning/nova/src/Http/Requests/InteractsWithRelatedResources.php:20)

shabbirbharmal commented 6 years ago

Can you please share how your fields method of Nova resource look like?

BrandDogs commented 6 years ago

Nevermind, i got it working. Thanks.

BrandDogs commented 6 years ago

Just got the same message again, with the following code:

new NovaTab('Overig',[

]),

shabbirbharmal commented 6 years ago

So is it throwing this error even when your second argument to Tab constructor is array of fields instead of empty array?

BrandDogs commented 6 years ago

yes, on both occasions.

FreekVR commented 6 years ago

Yes it appears that the "viaResource" attribute in the URL that is used to load in MorphMany or BelongstoMany relationships is being skipped when tabs are used to display a resource. I'm thinking it's a Vue prop that's getting lost somewhere along the way.

KarimQaderi commented 6 years ago

It also showed me the message

nova/src/Nova.php


public static function newResourceFromModel($model)
    {
        $resource = static::resourceForModel($model);
        if($resource == null)
            return $model;

        return new $resource($model);
    }

add

if($resource == null)
            return $model;
shabbirbharmal commented 6 years ago

Just got the same message again, with the following code:

new NovaTab('Overig',[

]),

I am not able to reproduce this issue. Probably something specific to your setup? If you are still facing this issue and willing to share your resource class I can take a look at it.

shabbirbharmal commented 6 years ago

Yes it appears that the "viaResource" attribute in the URL that is used to load in MorphMany or BelongstoMany relationships is being skipped when tabs are used to display a resource. I'm thinking it's a Vue prop that's getting lost somewhere along the way.

This issue is fixed and I believe it's not related to what @BrandDogs is facing.