how to manage a special error with special message in laravel

后端 未结 2 1567
不思量自难忘°
不思量自难忘° 2021-01-26 12:12

I\'m using laravel 5.4. and I need handle some error. imagine user logged in and opened two windows (his profile). When user click on logout in a window, we have still logout bu

2条回答
  •  猫巷女王i
    2021-01-26 12:45

    in App\Exceptions\Handler.php Return the user to the form with a new valid CSRF token, so the page will refreshed and logout button will not exist.

    public function render($request, Exception $exception)
    { 
       if($exception instanceof TokenMismatchException)
       { 
          return redirect()
                   ->back()
                   ->with('your msg');
       }
       return parent::render($request, $exception); 
    }
    

    this looking like, page was refreshed.

    Don't Replace POST with Get. It will not Safe And Standard.

自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题