2017-01-02 9 views
0

https://laravel.com/docs/5.3/authentication#authentication-quickstartパスのカスタマイズ方法のredirectToがLarave5.3で働いていない

それはあなたの代わりにredirectToプロパティのredirectToメソッドを定義することができ

を言う

しかし、私はLoginControllerにredirectToメソッドを追加しました。それは動作しません!!

まだ '/ home'にリダイレクトされています!

<?php 

namespace App\Http\Controllers\Mass\Auth; 

use App\Http\Controllers\Controller; 
use Illuminate\Foundation\Auth\AuthenticatesUsers; 

class LoginController extends Controller 
{ 
    /* 
    |-------------------------------------------------------------------------- 
    | Login Controller 
    |-------------------------------------------------------------------------- 
    | 
    | This controller handles authenticating users for the application and 
    | redirecting them to your home screen. The controller uses a trait 
    | to conveniently provide its functionality to your applications. 
    | 
    */ 

    use AuthenticatesUsers; 

    /** 
    * Where to redirect users after login. 
    * 
    * @var string 
    */ 
// protected $redirectTo = '/home'; 

    /** 
    * Create a new controller instance. 
    * 
    * @return void 
    */ 
    public function __construct() 
    { 
     $this->middleware('guest', ['except' => 'logout']); 
    } 

// public function index() 
// { 
//  return \Auth::user(); 
// } 

    protected function redirectTo() 
    { 
     // 
     die(var_dump(1)); 
    } 
} 
+0

はあなたが私たちのコードを示すことができたのか? – manix

答えて

0

同じことが私に起こり、ここに私のコード

<?php 

namespace App\Http\Controllers\Auth; 

use App\Http\Controllers\Controller; 
use Illuminate\Foundation\Auth\AuthenticatesUsers; 
use Log; 


class LoginController extends Controller 
{ 
    /* 
    |-------------------------------------------------------------------------- 
    | Login Controller 
    |-------------------------------------------------------------------------- 
    | 
    | This controller handles authenticating users for the application and 
    | redirecting them to your home screen. The controller uses a trait 
    | to conveniently provide its functionality to your applications. 
    | 
    */ 

    use AuthenticatesUsers; 


    protected $redirectTo = '/myaccount'; 


    public function __construct() 
    { 
     $this->middleware('guest', ['except' => 'logout']); 


    } 

    protected function redirectTo() 
    { 
     Log::info('redirecthere'); 
    } 

} 
+0

が見つかりました。https://github.com/laravel/framework/issues/17092 – June

関連する問題