phplaravellaravel-8laravel-authenticationlaravel-ui

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

  • 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 --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')