Authentication Quickstart: Authenticating

Path Customization

Protected $redirectTo = '/';
Protected function redirectTo()
{
    return '/path';
}

Username Customization

Public function username()
{
    return 'username';
}

Guard Customization

Is used to authenticate and register users.

Use Illuminate\Support\Facades\Auth;

protected function guard()
{
    return Auth::guard('guard-name');
}

Validation / Storage Customization

Manually Authenticating Users

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;

class LoginController extends Controller
{
    /**
     * Handle an authentication attempt.
     *
     * @param  \Illuminate\Http\Request $request
     *
     * @return Response
     */
    public function authenticate(Request $request)
    {
        $credentials = $request->only('email', 'password');

        if (Auth::attempt($credentials)) {
            // Authentication passed...
            return redirect()->intended('dashboard');
        }
    }
}

Authentication Quickstart: Authenticating — Structure map

Clickable & Draggable!

Authentication Quickstart: Authenticating — Related pages: