第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

會(huì)話超時(shí)時(shí)如何配置重定向 URL - Laravel 5.8?

會(huì)話超時(shí)時(shí)如何配置重定向 URL - Laravel 5.8?

PHP
一只斗牛犬 2022-01-23 10:56:38
當(dāng)會(huì)話超時(shí) - 我一直重定向到:http://bheng.test/login導(dǎo)致崩潰如何覆蓋此行為以重定向到:http://bheng.test?這是我的 AuthMiddleware.php<?phpnamespace App\Http\Middleware;use Closure, View;use Illuminate\Contracts\Auth\Guard;class Authenticate {    /**     * The Guard implementation.     *     * @var Guard     */    protected $auth;    /**     * Create a new filter instance.     *     * @param  Guard  $auth     * @return void     */    public function __construct(Guard $auth)    {        $this->auth = $auth;    }    /**     * Handle an incoming request.     *     * @param  \Illuminate\Http\Request  $request     * @param  \Closure  $next     * @return mixed     */    public function handle($request, Closure $next)    {        if ($this->auth->guest())        {            if ($request->ajax())            {                return response('Unauthorized.', 401);            }            else            {                return redirect()->guest('/');                // return response('Unauthorized.', 401);                // return View::make('layouts.share.errors.404');            }        }        return $next($request);    }}
查看完整描述

2 回答

?
猛跑小豬

TA貢獻(xiàn)1858條經(jīng)驗(yàn) 獲得超8個(gè)贊

Authenticate.php根據(jù) Laravel 文檔,您只需在中間件中使用要重定向到的 pat 定義此方法:


/**

 * Get the path the user should be redirected to.

 *

 * @param  \Illuminate\Http\Request  $request

 * @return string

 */

protected function redirectTo($request)

{

    return route('login');

}

在重定向未經(jīng)身份驗(yàn)證的用戶段落下的更多信息。


查看完整回答
反對 回復(fù) 2022-01-23
?
肥皂起泡泡

TA貢獻(xiàn)1829條經(jīng)驗(yàn) 獲得超6個(gè)贊

   <?php


namespace App\Http\Middleware;


use Illuminate\Auth\Middleware\Authenticate as Middleware;


class Authenticate extends Middleware

{

    /**

     * Get the path the user should be redirected to when they are not authenticated.

     *

     * @param  \Illuminate\Http\Request  $request

     * @return string

     */

    protected function redirectTo($request)

    {

        if (! $request->expectsJson()) {

            return route('login');

        }

    }

}


查看完整回答
反對 回復(fù) 2022-01-23
  • 2 回答
  • 0 關(guān)注
  • 193 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)