How to Show Notification using Sweet Alert in Laravel 10

How to Implement and Use Sweet Alert in Laravel 10

  1. Create Laravel Project
  2. Add Database Details
  3. Seed Users in Database
  4. Create New Controller
  5. Build View Template
  6. Create New Routes
  7. Run Development Server

1. Create Laravel Project

composer create-project laravel/laravel --prefer-dist laravel-demo
cd laravel-demo

2. Add Database Details

Since we are storing user data in the database, we must connect the MySQL database with Laravel.

You can do it by adding your database information to .env file.

DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=laravel_db
DB_USERNAME=root
DB_PASSWORD=

For the macOS MAMP PHP server; make sure to additionally include UNIX_SOCKET and DB_SOCKET right below the database details in .env file.

UNIX_SOCKET=/Applications/MAMP/tmp/mysql/mysql.sock
DB_SOCKET=/Applications/MAMP/tmp/mysql/mysql.sock