Contact US


Get Your Project Done by our experts
info@fundaofwebit.com

How to make Login and Register System using Auth Command in Laravel 5.8

Laravel Auth Command | Login and Register using Auth Command


Step 1: Install your Laravel by issuing the Composer with the command called create-project command in your terminal:


composer create-project --prefer-dist laravel/laravel blog "5.8.*"


Step 2: Setup your database (DB) and set the credentials in your environment file (.env) in your installed laravel application.


DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=your_database #do not use this symbol Hash (#) in database
DB_USERNAME=your_username #do not use this symbol Hash (#) in username
DB_PASSWORD=your_password #do not use this symbol Hash (#) in password


Step 3: Go to your application and open the folder by following: App / Providers / AppServiceProvider.php, open this file and add the below code, to set the defaultStringLength to skip the Error called: Specified key was too long error.


    use Illuminate\Support\Facades\Schema;

public function boot()
    {
        Schema::defaultStringLength(191);
    }


Step 4: Now, lets set the login and registration system using laravel auth command by below code:


php artisan make:auth


Step 5: After successfull installation of laravel auth command, then we need to migrate the laravel default table's (Which Already Exists in database folder). So, now lets migrate the tables by following below command:


php artisan migrate


Step 6: Now, everything is perfect, so lets run the artisan serve command to get registered and login to it.


php artisan serve


The Url to Login: http://localhost:8000/login

The Url to Register: http://localhost:8000/register