buiduydong

Error: Class not found

laravel Icon

Error

Class not found

An unhandled exception occurred on line 15
12
    public function __construct()
13
    {
14
        $menu = Menus::where('name','menu-main')->with('items')->first();
15
        View::share('menu', $menu);
16
    }

Solution

Yeah, that won't work. To use Laravel classes, you need Laravel's autoloader.

The correct way of doing this is a [custom Artisan command](https://laravel.com/docs/5.4/artisan#writing-commands).            
View solution externally on StackOverflow
Apr 14, 2021 Anyone

0 replies


Install the browser extension

Found this solution helpful? Try our extension for quick solutions to your Laravel errors.

Chrome logo Add to Chrome - It's free