Monday, March 13, 2017

Laravel login redirect

I'm trying to redirect the login to another page.

Right now it's redirecting to '/' even though in the login controller it says '/welcome'. (Using default authentication of laravel).

It looks like it completely ignores the login controller.

LoginController.php

    <?php

namespace App\Http\Controllers\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 = '/welcome'; 

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

As it seems like it's completely ignoring the login controller, i'm confused on how it's even possible to login.



via Mario Eekma

Advertisement