-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Model not found #23
Comments
Please check if the class you specified in the |
These lines are set in the laravel-permission config file:
I thought that this was pointing to the vendor/spatie dir? |
@freekmurze any suggestions? |
[2016-01-01 18:34:52] local.ERROR: Symfony\Component\Debug\Exception\FatalThrowableError: Fatal error: Class 'App\Role' not found in /home/vagrant/timecontrol/bootstrap/cache/compiled.php:10223
Stack trace:
#0 /home/vagrant/timecontrol/app/User.php(43): Illuminate\Database\Eloquent\Model->belongsToMany('App\\Role')
#1 /home/vagrant/timecontrol/bootstrap/cache/compiled.php(10925): App\User->roles()
#2 /home/vagrant/timecontrol/bootstrap/cache/compiled.php(10914): Illuminate\Database\Eloquent\Model->getRelationshipFromMethod('roles')
#3 /home/vagrant/timecontrol/bootstrap/cache/compiled.php(10891): Illuminate\Database\Eloquent\Model->getRelationValue('roles')
#4 /home/vagrant/timecontrol/bootstrap/cache/compiled.php(11211): Illuminate\Database\Eloquent\Model->getAttribute('roles')
#5 /home/vagrant/timecontrol/vendor/spatie/laravel-permission/src/Traits/HasRoles.php(73): Illuminate\Database\Eloquent\Model->__get('roles')
#6 /home/vagrant/timecontrol/storage/framework/views/b236f9316f106af841d4ba903d059477(2): App\User->hasRole('writer')
#7 /home/vagrant/timecontrol/bootstrap/cache/compiled.php(14626): include('/home/vagrant/t...')
#8 /home/vagrant/timecontrol/bootstrap/cache/compiled.php(14662): Illuminate\View\Engines\PhpEngine->evaluatePath('/home/vagrant/t...', Array)
#9 /home/vagrant/timecontrol/bootstrap/cache/compiled.php(14495): Illuminate\View\Engines\CompilerEngine->get('/home/vagrant/t...', Array)
#10 /home/vagrant/timecontrol/bootstrap/cache/compiled.php(14483): Illuminate\View\View->getContents()
#11 /home/vagrant/timecontrol/bootstrap/cache/compiled.php(14474): Illuminate\View\View->renderContents()
#12 /home/vagrant/timecontrol/bootstrap/cache/compiled.php(15623): Illuminate\View\View->render()
#13 /home/vagrant/timecontrol/bootstrap/cache/compiled.php(15138): Illuminate\Http\Response->setContent(Object(Illuminate\View\View))
#14 /home/vagrant/timecontrol/bootstrap/cache/compiled.php(7688): Symfony\Component\HttpFoundation\Response->__construct(Object(Illuminate\View\View))
#15 /home/vagrant/timecontrol/bootstrap/cache/compiled.php(8915): Illuminate\Routing\Router->prepareResponse(Object(Illuminate\Http\Request), Object(Illuminate\View\View))
#16 [internal function]: Illuminate\Routing\ControllerDispatcher->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#17 /home/vagrant/timecontrol/bootstrap/cache/compiled.php(9585): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#18 /home/vagrant/timecontrol/app/Http/Middleware/Authenticate.php(45): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#19 [internal function]: App\Http\Middleware\Authenticate->handle(Object(Illuminate\Http\Request), Object(Closure))
#20 /home/vagrant/timecontrol/bootstrap/cache/compiled.php(9577): call_user_func_array(Array, Array)
#21 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#22 /home/vagrant/timecontrol/bootstrap/cache/compiled.php(9567): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#23 /home/vagrant/timecontrol/bootstrap/cache/compiled.php(8916): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#24 /home/vagrant/timecontrol/bootstrap/cache/compiled.php(8901): Illuminate\Routing\ControllerDispatcher->callWithinStack(Object(App\Http\Controllers\StaffController), Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), '$
#25 /home/vagrant/timecontrol/bootstrap/cache/compiled.php(7855): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'App\\Http\\Contro...', 'edit')
#26 /home/vagrant/timecontrol/bootstrap/cache/compiled.php(7826): Illuminate\Routing\Route->runWithCustomDispatcher(Object(Illuminate\Http\Request))
#27 /home/vagrant/timecontrol/bootstrap/cache/compiled.php(7479): Illuminate\Routing\Route->run(Object(Illuminate\Http\Request))
#28 [internal function]: Illuminate\Routing\Router->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#29 /home/vagrant/timecontrol/bootstrap/cache/compiled.php(9585): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#30 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#31 /home/vagrant/timecontrol/bootstrap/cache/compiled.php(9567): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#32 /home/vagrant/timecontrol/bootstrap/cache/compiled.php(7480): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#33 /home/vagrant/timecontrol/bootstrap/cache/compiled.php(7468): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#34 /home/vagrant/timecontrol/bootstrap/cache/compiled.php(7453): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#35 /home/vagrant/timecontrol/bootstrap/cache/compiled.php(2302): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#36 [internal function]: Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request))
#37 /home/vagrant/timecontrol/bootstrap/cache/compiled.php(9585): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#38 /home/vagrant/timecontrol/vendor/barryvdh/laravel-debugbar/src/Middleware/Debugbar.php(49): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#39 [internal function]: Barryvdh\Debugbar\Middleware\Debugbar->handle(Object(Illuminate\Http\Request), Object(Closure))
#40 /home/vagrant/timecontrol/bootstrap/cache/compiled.php(9577): call_user_func_array(Array, Array)
#41 /home/vagrant/timecontrol/bootstrap/cache/compiled.php(2926): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#42 [internal function]: Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle(Object(Illuminate\Http\Request), Object(Closure))
#43 /home/vagrant/timecontrol/bootstrap/cache/compiled.php(9577): call_user_func_array(Array, Array)
#44 /home/vagrant/timecontrol/bootstrap/cache/compiled.php(12949): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#45 [internal function]: Illuminate\View\Middleware\ShareErrorsFromSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#46 /home/vagrant/timecontrol/bootstrap/cache/compiled.php(9577): call_user_func_array(Array, Array)
#47 /home/vagrant/timecontrol/bootstrap/cache/compiled.php(11536): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#48 [internal function]: Illuminate\Session\Middleware\StartSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#49 /home/vagrant/timecontrol/bootstrap/cache/compiled.php(9577): call_user_func_array(Array, Array)
#50 /home/vagrant/timecontrol/bootstrap/cache/compiled.php(12686): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#51 [internal function]: Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(Object(Illuminate\Http\Request), Object(Closure))
#52 /home/vagrant/timecontrol/bootstrap/cache/compiled.php(9577): call_user_func_array(Array, Array)
#53 /home/vagrant/timecontrol/bootstrap/cache/compiled.php(12623): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) |
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Spatie\Permission\Models\Role;
use Spatie\Permission\Models\Permission; |
//The config file settings
<?php
return [
/*
|--------------------------------------------------------------------------
| Authorization Models
|--------------------------------------------------------------------------
*/
'models' => [
/*
|--------------------------------------------------------------------------
| Permission Model
|--------------------------------------------------------------------------
|
| When using the "HasRoles" trait from this package, we need to know which
| Eloquent model should be used to retrieve your permissions. Of course, it
| is often just the "Permission" model but you may use whatever you like.
|
| The model you want to use as a Permission model needs to implement the
| `Spatie\Permission\Contracts\Permission` contract.
|
*/
'permission' => Spatie\Permission\Models\Permission::class,
/*
|--------------------------------------------------------------------------
| Role Model
|--------------------------------------------------------------------------
|
| When using the "HasRoles" trait from this package, we need to know which
| Eloquent model should be used to retrieve your roles. Of course, it
| is often just the "Role" model but you may use whatever you like.
|
| The model you want to use as a Role model needs to implement the
| `Spatie\Permission\Contracts\Role` contract.
|
*/
'role' => Spatie\Permission\Models\Role::class,
], |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm facing a issue since this morning i get this error.
in my controller i added
in my view
Do you have any suggestions?
The text was updated successfully, but these errors were encountered: