Create a folder where you want to install the Laravel project. In my case, I am going to install it on D drive. and open the folder and just paste the below code.
composer create-project laravel/laravel example-app
Here example-app your Laravel application name. choose according to your project.
Now you have to install Laravel UI for the authentication system in Laravel. Below is the command
composer require laravel/ui
Make sure before installing the package go to the providers folder and Appserviceprovider.php file
public function boot()
{
//
Schema::defaultStringLength(191);
}
and it use it on the top
use Illuminate\Support\Facades\Schema;
Now install the Laravel UI and once install the package run below command
php artisan ui:auth
You get the message like below
INFO Authentication scaffolding generated successfully.
Now add Bootstrap, CSS, and JS to your project folder. So go to your public directory make a folder frontend and under the frontend folder create an asset folder and under the asset folder create CSS, and JS folder, and paste the code.
Now run the command
php artisan serve
you will get an error like below
Vite manifest not found at D:\acplecom\public\build/manifest.json
So simply go to the app.blade.php file and remove the below code from the head of the tag
@vite(['resources/sass/app.scss', 'resources/js/app.js'])
Now your project will successfully run. for the login and register design part we have to link our CSS and js files.
Example like bellow
For the script before ending the body tag like below
And CSS like below under the head tag
Note: asset represents your public folder.
When we are using Laravel default auth system under the migration users table has been created automatically.
But before registering or login, we have to create a database and give database credentials .env file. and run the command below
php artisan migrate
But we will add an extra column in users table like below.
$table->tinyInteger('role')->default('0'); // 0 means user
Your .env file like below
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=databsename
DB_USERNAME=databaseusername
DB_PASSWORD=databasepassword
Run the command
php artisan migrate
Now your register and login part successfully done