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
}
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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With