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.

Seeder<br />

In a normal web app with a login system, you'd have a registration page so users<br />

can create their own accounts. To ensure this book doesn't get too long, we'll<br />

skip that feature <strong>and</strong> instead generate user accounts with a database seeder: $<br />

php artisan make:seeder UsersTableSeeder<br />

You can implement a registration page for <strong>Vue</strong>bnb yourself if you<br />

want. The <strong>Laravel</strong> documentation covers it quite thoroughly at https<br />

://laravel.com/docs/5.5/authentication.<br />

Let's create at least one account with a name, email, password, <strong>and</strong> an array of<br />

saved listings. Note that I've used the make method of the Hash facade to hash the<br />

password rather than storing it as plain-text. <strong>Laravel</strong>'s default LoginController will<br />

automatically verify plain-text passwords against the hash during the login<br />

process.<br />

database/seeds/UsersTableSeeder.php:

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

Saved successfully!

Ooh no, something went wrong!