Error

We're sorry, but an unhandled error occurred. Please see the details below.

Call to a member function products() on null

/home/p/pokroff/new/public_html/plugins/wms/site/components/CategoryProducts.php line 29

    {
        return \Wms\Site\Models\CategoryProducts::orderBy('sort_order', 'ASC')->get();
    }
 
    public function getCategoryCatalog($slug)
    {
        $item = \Wms\Site\Models\CategoryProducts::where('slug', $slug)->first()->products()->paginate(20);
        return $item;
    }
}

Stack trace

# Called Code Document Line