'How to properly start Laravel 8 with Bootstrap & authentication

I face the following image every time I want to start a new Laravel 8 project with authentication routes set up using the laravel/ui package and Bootstrap scaffolding.

capture

Meaning that the Bootstrap is not yet loading up! Therefore, I have to re-run php artisan UI bootstrap & npm install && npm run dev to correctly set them up.

Here are the steps that I use for creating a new Laravel 8 project:

Install LARAVEL: laravel new [yourprojectname]
Install LARAVEL UI Package: composer require laravel/ui
Generate UI Bootstrap: php artisan ui bootstrap 
Generate Auth Scaffolding: php artisan ui bootstrap --auth
Install NPM Dependencies: npm install && npm run dev
Running LARAVEL: php artisan serve

But now I want to get this thing straight in my head so I won't have to re-run the codes anymore. I mean, what are the correct step-by-step commands for running to have a complete and ready project?



Solution 1:[1]

The steps are correct. For every new Laravel 8.x project that will include Bootstrap and auth scaffolding, you want to run the following.

composer require laravel/ui
php artisan ui bootstrap
php artisan ui bootstrap --auth
npm install && npm run dev

Make a note of the generated /resources/views/layouts/app.blade.php. You will want to include this in all of your views.

@extends('layouts.app')

Solution 2:[2]

Open your windows powershell or cmd do these step:

Step-1: Create your laravel app by entering in your cmd or powershell,

composer create-project laravel/laravel [yourapp name]

after creating app, enter php artisan serve to run this app in browser.

After running complete....... Now, this is how i solve my problem, first close the present tab of powershell or cmd (doesn't matter if app have been running) and reopen powershell or cmd. This time do these: (During these steps don't try to run your app or PHP artisan serve)

Step-2: Install laravel ui by entering :

composer require laravel/ui

Step-3: Generate Bootstrap ui by entering :

php artisan ui bootstrap

Step-4: install npm by entering:

npm install

Step-5: if npm installation finished, enter:

npm run dev

Step-6: now install Auth Scaffolding by entering:

php artisan ui bootstrap --auth

Step-7: again install npm by entering:

npm install

Step-8: again, enter:

npm run dev

After finishing Step-8, test and run your app: php artisan serve

Solution 3:[3]

You can try it from the beginning:

Create project

composer create-project --prefer-dist laravel/laravel blade-example-app

Go to the directory

cd blade-example-app

UI Command

composer require laravel/ui

AUTH with Bootstrap

php artisan ui bootstrap --auth

Run Dependencies

npm install && npm run dev

Run Migration

php artisan migrate

Run the project

php artisan serve

Solution 4:[4]

you can pass the bootstrap css link in your layouts/app.blade.php then bootstrap will be called in every referenced page that Extends('layouts.app')

Solution 5:[5]

  1. Install the latest laravel project using this command: laravel new (project_name)

  2. Install ui package of laravel through composer : Composer require laravel/ui

  3. After installing ui package Please install ui bootstrap php artisan ui bootstrap ater this command run a command for bootstrap auth php artisan ui bootstrap --auth

  4. At the end run a command npm install && npm run dev or npm install and npm run dev now you are complete your authentication system with laravel

  5. Run the command php artisan serve

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2
Solution 3 veryreverie
Solution 4 MARCUS KASUNI
Solution 5 Elikill58