Why my middleware is not working,I try to put some parameter inside the middleware and its not working

青春壹個敷衍的年華 提交于 2019-12-12 23:17:18

问题


My middleware should block user with restric_desc = Revoke Student Portal Access. But it end up blocking all user from accessing the tab.

Route::group(['middleware' => ['auth'], 'request' =>App\Models\BlockReason::where('IS_ACTIVE','0')->pluck('ID')], function () {
    Route::group(['middleware' => 'block', 'request' => App\Models\BlockRestricType::where('RESTRIC_DESC', 'Revoke Student Portal Access')->pluck('ID')],function(){

My middleware

 public function handle($request, Closure $next)
{
    $var= $request->route()->getAction();

    if($request->IS_ACTIVE != 0){
        if($request->RESTRIC_DESC == 'Revoke Student Portal Access'){
        return redirect('/');
        }
    }
    return $next($request);
}

来源:https://stackoverflow.com/questions/57138882/why-my-middleware-is-not-working-i-try-to-put-some-parameter-inside-the-middlewa

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!