
Laravel 8 Authentication Setup with UI (Vue)
Follow these steps to install and configure Laravel 8 with authentication and Vue.js.
Step 1: Install Laravel
Start by creating a new Laravel project via Composer:
composer create-project --prefer-dist laravel/laravel laravel_dashboard_version9
Step 2: Install Laravel UI
Laravel UI provides the basic scaffolding for front end with authentication. Run the following commands:
composer require laravel/ui php artisan ui vue --auth
This will scaffold Vue.js and authentication routes, views, and controllers.
Step 3: Configure Database
Open your .env
file located at the root of your project and update the following lines with your database credentials:
DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=your_db_name DB_USERNAME=root DB_PASSWORD=your_db_password
Optional: Configure Mail Settings (for Forgot Password Feature)
Still in the .env
file, add your mail configuration:
MAIL_MAILER=smtp MAIL_HOST=smtp.gmail.com MAIL_PORT=587 MAIL_USERNAME=your_email@gmail.com MAIL_PASSWORD=your_email_password MAIL_ENCRYPTION=tls
š” Make sure to allow less secure apps or use an app password if you're using Gmail.
Step 4: Run Migrations
Now, create the necessary tables by running the migration command:
php artisan migrate
Step 5: Start the Development Server
Run the development server using:
php artisan serve
Then, visit your app in the browser:
http://localhost:8000
Or if installed in a subfolder:
http://localhost/laravel_dashboard_version9/public/
You should now see the login and registration pages powered by Vue.js and Laravel’s built-in authentication.