laravel 5.3自定义登陆成功后的跳转路由无效?
下面是我LoginController中的代码:
<?php
namespace App\Http\Controllers\User\Ui\Auth;
use App\Http\Controllers\Controller as Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Illuminate\Support\Facades\Redirect;
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 = '/';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest', ['except' => 'logout']);
config(['app.name' => '点跃']);
}
public function index()
{
return \Auth::user();
}
protected function redirectTo()
{
die('ok');
return Redirect::route('index');
}
}
但是登录成功后任然跳转到/home那个页面
1 Comment
laravel 自带的 注册登陆 好像 跳转的地址 就是你注释掉的那个
$redirectTo
属性你现在写了个方法,可修改了默认跳转的方法?