I'm new to Laravel and I'm developing an application with User, Roles ans Permission. For this I'm using Zizaco/Entrust. I'm almost done with all of the steps but I'm not able to show the custom page for 403. My code are as follows :
Permission : role-list
Role : Manager
'role-list'
is assigned to 'manager'
role and then 'manager'
role is assiged to 'ABC' user.
In my app\kernel file id added these middlewares :
protected $routeMiddleware = [
'auth' => \Eybos\Http\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'can' => \Illuminate\Foundation\Http\Middleware\Authorize::class,
'guest' => \Eybos\Http\Middleware\RedirectIfAuthenticated::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'role' => \Zizaco\Entrust\Middleware\EntrustRole::class,
'permission' => \Zizaco\Entrust\Middleware\EntrustPermission::class,
'ability' => \Zizaco\Entrust\Middleware\EntrustAbility::class,
];
In my routes file :
Route::get( 'backend/roles', [ 'as' => 'backend.roles.index', 'uses' => 'Backend\RoleController@index', 'middleware' => ['permission:role-list|role-create|role-edit|role-delete']] );
And then created a file : resources/views/errors/403.blade.php
@extends('layouts.backend')
@section('content')
<h1>You don't have permission.</h1>
@endsection
But when I try to access the page I get this error :
FatalErrorException in Decorator.php line 80:
Trying to clone an uncloneable object of class Symfony\Component\HttpKernel\Exception\HttpException