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

priyalaks's avatar

Laravel Nova - Belongs to many - Class not Found

I have tables called Store and Items . There is a pivot between these 2 tables. I have a belongs to Many relationship on Store and Item Models.

When I try to display the Items connected to store in the Store Details page - Its throwing Class "App\Nova\Admin.store.item" not found

My Store Model :

public function items()
    {
        return $this->belongsToMany(Item::class, 'store_items', 'store_id', 'item_id')->withPivot('name','price');
    }

My Store.php

public static $model = \App\Models\Store::class;
public function fields(Request $request)
    {
        return [
            ID::make()->sortable(),            
           BelongsToMany::make(__('admin.store.items'), 'items'),   

        ];
    }

Can someone point me out where am I going to wrong ..

0 likes
1 reply
RayC's avatar

Try calling it like this in nova:

BelongsToMany::make('Items'),
1 like

Please or to participate in this conversation.