How to properly start Laravel 8 with Bootstrap & authentication
Asked Answered
M

6

23

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?

Minify answered 13/2, 2021 at 19:20 Comment(0)
L
41

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')
Liva answered 13/2, 2021 at 20:15 Comment(4)
You can run php artisan ui bootstrap and php artisan ui bootstrap --auth at the same time, like this : php artisan ui bootstrap --authCharmer
Getting error "Vite manifest not found at: /Applications/MAMP/htdocs/laravelproject/public/build/manifest.json. Any suggestion??Septillion
@Septillion Maybe try: npm run buildLiva
@Septillion And/or upgrade npm globally: npm i -g npm@latestLiva
A
9

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

Accumulator answered 18/1, 2022 at 5:40 Comment(1)
I guess php artisan ui bootstrap --auth includes php artisan ui bootstrap. So, why you are saying to run both separately?Sicanian
S
-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

Scenography answered 17/1, 2022 at 10:25 Comment(0)
H
-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
Hoffert answered 19/2, 2022 at 20:29 Comment(0)
F
-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

Formic answered 20/7, 2022 at 16:14 Comment(1)
You might enjoy this info for making your posts more apealing and readable. stackoverflow.com/editing-helpLushy
G
-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')

Glaswegian answered 4/1, 2022 at 15:47 Comment(2)
This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From ReviewInunction
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.Aerophagia

© 2022 - 2024 — McMap. All rights reserved.