20

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?

Karl Hill
  • 12,937
  • 5
  • 58
  • 95

6 Answers6

36

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')
Karl Hill
  • 12,937
  • 5
  • 58
  • 95
8

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

  • I guess `php artisan ui bootstrap --auth` includes `php artisan ui bootstrap`. So, why you are saying to run both separately? – Zain Shabir Jul 30 '22 at 08:41
-1
  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

Elikill58
  • 4,050
  • 24
  • 23
  • 45
-1

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
veryreverie
  • 2,871
  • 2
  • 13
  • 26
shovon lal
  • 24
  • 1
-1

Just upgrade to php -v 8.0.* & run npm install && npm run dev because in present time laravel default install vite package and vite required php -v 8

  • 2
    You might enjoy this info for making your posts more apealing and readable. https://stackoverflow.com/editing-help – Yunnosch Jul 20 '22 at 16:43
-2

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

  • 1
    This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/30737025) – Lajos Arpad Jan 08 '22 at 13:16
  • This is a dumb idea. You don't get any updates on the bootstrap dependency. You become dependent on external links if you for example include a cdn link. If that cdn is down your website loses all styling. If you include bootstrap in your website manually you need to maintain it and include all the js and css files to your project. – Martijn Hiemstra Aug 27 '22 at 17:46