25.06.2018 Views

Full-Stack Vue.js 2 and Laravel 5

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Controller { use AuthenticatesUsers; protected $redirectTo = '/home'; public<br />

function __construct() { $this->middleware('guest')->except('logout'); } }<br />

This class uses an AuthenticatesUsers trait that defines the showLoginForm method that<br />

the /login route h<strong>and</strong>ler refers to. Let's overwrite that method so it simply returns<br />

our app view. Since this instance of the view doesn't need any data to be inlined<br />

in the head (the login form has no state), we will pass an empty array to the data<br />

template variable.<br />

App\Http\Controllers\Auth\LoginController.php: class LoginController extends<br />

Controller { ... public function showLoginForm() { return view('app', ['data' =><br />

[]]); } }<br />

With that done, we can now see our complete login page by navigating the<br />

browser to /login:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!