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/Products.php line 97

    {
        return \Wms\Site\Models\Products::where('is_news', 1)->orderBy('id', 'desc')->get();
    }
 
    public function getItem($category_slug, $slug)
    {
        $item = \Wms\Site\Models\CategoryProducts::where('slug', $category_slug)->first()->products()->where(
            'slug',
            $slug
        )->where('active', 1)->first();
 
        //404 при не опубликованном продукте
        if (is_null($item)) {

Stack trace

# Called Code Document Line