Ad

FatalErrorException In Model.php Line 986: Class 'App\Role' Not Found

- 1 answer

My routes.php file is

<?php
use App\models\User;
use App\models\Permission;
use App\models\Role;

Route::get('/roles', function()
{
 //code
}

and my role.php file is

 <?php
 namespace App\models;
 use Zizaco\Entrust\EntrustRole;

 class Role extends EntrustRole
 { 

 }

and I found the error like this

FatalErrorException in Model.php line 986: Class 'App\Role' not found

Ad

Answer

The default Entrust config file looks for models inside the App namespace, not the App\models namespace. You need to publish the config file and update it accordingly:

'role' => 'App\models\Role',
Ad
source: stackoverflow.com
Ad