问题
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