I am using middleware on my route like below
Route::get('posts', 'PostControlle@index')->middleware('ability:super_admin,canViewPost,false');
but I am getting an InvalidArgumentException.
I am using middleware on my route like below
Route::get('posts', 'PostControlle@index')->middleware('ability:super_admin,canViewPost,false');
but I am getting an InvalidArgumentException.
I believe the problem is in ability() method of vendor\zizaco\entrust\src\Entrust\Traits\EntrustUserTrait.php class. So, I've overridden this method in User.php model class.
The third parameter will string value If we pass third parameter in Ability middleware from route or controller class. Like:
But if we use Blade Directive then it will Boolean
So, we should pass it as string in @Ability Blade Directive. Like:
and we need to override the Ability Method. Put below method in User.php file