Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error Illuminate Database Eloquent Not Found

In the Controller when i tried to call a function from a model it Through Exception

Symfony \ Component \ Debug \ Exception \ FatalErrorException (E_ERROR)

Class 'Illuminate\Database\Eloquent' not found

the controller is simple and i used to create name space to manage sub directories controllers and model

<?php
namespace Manage ;
use Illuminate\Support\Facades\View;
use Illuminate\Routing\Controller;
class BaseController extends Controller {

    /**
     * Setup the layout used by the controller.
     *
     * @return void
     */
                    protected $layout = 'manage.layouts.master';
    protected function setupLayout()
    {
        if ( ! is_null($this->layout))
        {
            $this->layout = View::make($this->layout)->with(Dashboard::all());
        }
    }

}

and model

<?php
namespace Manage ;
use Illuminate\Database\Eloquent;
class Dashboard extends Eloquent{
    protected $table = 'admin_dashboard_sidebar';
    //put your code here
}
like image 591
Dr.Neo Avatar asked Dec 11 '22 03:12

Dr.Neo


1 Answers

The class is Model:

use Illuminate\Database\Eloquent\Model as Eloquent;

or just

use Eloquent;

This last one is an alias to the class you can find in your app/config/app.php.

like image 153
Antonio Carlos Ribeiro Avatar answered Dec 20 '22 19:12

Antonio Carlos Ribeiro