Create Scaffold with Laravel 5.7 — Authentication (Part 1)

Alfredo Barron
Sep 20, 2018 · 3 min read

We will create a scaffold with Laravel 5.7 to using like base for our future projects. The first step is learning to create a authentication system.


Table of Contents

Install Laravel Application

First step open your terminal and typing the next command:

laravel new laravel-scaffold

Install Laravel Authentication

Enter to folder project an run the next command:

cd laravel-scaffold
php artisan make:auth

Create DB

Run the next commands:

mysql -u{user} -p{password}
mysql> create database laravel-scaffold;

Configure DB

Edit .env file

nano .env

Into .env file fill the data base vars

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel-scaffold
DB_USERNAME=user
DB_PASSWORD=password

Create tables

Run the next command:

php artisan migrate

Generate User Table Seed

Create UsersTableSeeder.php with the next command:

php artisan make:seeder UsersTableSeeder

Into UsersTableSeeder.php file write the next code:

<?php

use Illuminate\Database\Seeder;

class UsersTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
factory(App\User::class, 50)->create();
}
}

Add UsersTableSeeder.php seeder to DatabaseSeeder.php

<?phpuse Illuminate\Database\Seeder;class DatabaseSeeder extends Seeder
{
/**
* Seed the application's database.
*
* @return void
*/
public function run()
{
$this->call(UsersTableSeeder::class);
}
}

Run seed

php artisan db:seed

Install Vuejs Frontend

Run the next command:

npm install

Add Browsersync Reloading into webpack.mix.js file

mix.js('resources/js/app.js', 'public/js')
.sass('resources/sass/app.scss', 'public/css')
.browserSync('laravel-scaffold.test');

Finally Compiling Assets (Laravel Mix) with the next commans:

npm run dev
// or
npm run watch

Now we have the next screen when enter the http://localhost:3000 route in browser

http://localhost:3000/login

http://localhost:3000/register

http://localhost:3000/password/reset


modulr

Tutorials for Developers Laravel/AWS/Linux

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store