How to check user online or not in Laravel 8 app. Here, you will learn how to check user online status and last seen.

If you’re building social media web app in laravel. At that time, you need to show users status (online/offline) and last seen. So this tutorial will guide you step by step from scratch to implement laravel determine users status and last seen app.

How to Check User Online or Not in Laravel 8

  • Step 1: Install Laravel 8 App
  • Step 2: Connecting App to Database
  • Step 3: Generate Auth Scaffolding
  • Step 4: Add Column in User Table
  • Step 5: Create a Middleware
  • Step 6: Register Middleware in Kernel
  • Step 7: Create Controller by Artisan
  • Step 8: Check Online Status in Blade File
  • Step 9: Run Development Server

Step 1: Install Laravel 8 App

In this step, Execute the following command on terminal to install laravel latest application setup, So open your terminal OR command prompt and run the following command:

composer create-project --prefer-dist laravel/laravel blog 

Step 2: Connecting App to Database

After successfully install laravel new app. Next, Go to your laravel app root directory and open .env file. Then add database details as follow:

DB_CONNECTION=mysql 
DB_HOST=127.0.0.1 
DB_PORT=3306 
DB_DATABASE=here your database name here
DB_USERNAME=here database username here
DB_PASSWORD=here database password here

#laravel #php #web-development #programming #developer

How to Check User Online or Not in Laravel 8
16.90 GEEK