Category Archives: Laravel

Laravel Tutorials

Laravel 8 Auth Scaffolding using Jetstream Tutorial

In this Laravel 8 Auth Scaffolding using Jetstream Tutorial I will show how to create login, register, logout, forget password, profile and reset password page using laravel jetstream authentication scaffolding without using laravel 8 make:auth command. Jetstream auth with livewire is laravel package that enable us to generate default laravel authentication scaffolding. Laravel jetstream auth includes fully functional login, register, logout, reset password, forget password, email verification, two-factor authentication, session management.

In this laravel 8 jetstream auth scaffolding tutorial I will show you how to use jetstream and livewire package to create auth scaffolding in laravel 8. Jetstream auth will include login, register, reset the password, forget password, email verification, and two-factor authentication blade views and controller file.

Laravel 8 Auth Scaffolding using Jetstream Tutorial

In this step by step Laravel 8 Auth Scaffolding using Jetstream Tutorial I will demonstrate you to implement jetstream authentication scaffolding in laravel 8. Please follow the instruction given below:

  • Step 1 – Install Laravel 8 App
  • Step 2 – Database Configuration
  • Step 3 – Install Auth Scaffolding Jetstream
  • Step 4 – Install Livewire Package
  • Step 5 – Jetstream Configuration
  • Step 6 – Run PHP artisan Migrate
  • Step 7 – Install Npm Packages
  • Step 8 – Run Development Server

Step 1 – Install Laravel 8 App

First of all we need to create a fresh laravel project, download and install Laravel 8 using the below command

Step 2 – Database Configuration

Now, lets create a MySQL database and connect it with laravel application. After creating database we need to set database credential in application’s .env file.

Step 3 – Install Auth Scaffolding Jetstream

In this step, we will install Jetstream Package via the composer dependency manager. Use the following command to install Jetstream.

Step 4 – Install Livewire Package

Now run following command to create basic authentication scaffolding login, register, logout and email verification views file:

Step 5 – Jetstream Configuration

Next, we will open fortify.php file and will enable and disable option of jetstream package as per requirement, which is located inside config directory.

Step 6 – Run php artisan Migrate

Now, run following command to migrate database schema.

Step 7 – Install Npm Packages

Then type the following command on cmd to run npm:

Step 8 – Run Development Server

Now we are ready to run our example so lets start the development server using following artisan command –

Now, open the following URL in browser to see the output –

Laravel 8 Socialite Google Login Example Tutorial

In this Laravel 8 Socialite Google Login Example Tutorial I’ll show you how to integrate google login in laravel 8 using socialite package. Integrating google login in Laravel 8 using socialite package is much easier. Allowing users to login with their social media accounts makes registration/login process much easier, it also encourages more users to register for your application.

Laravel 8 Socialite Google Login Example Tutorial

In this step by step tutorial, you will learn to integrate google login with your laravel 8 application. Please follow the steps give below:

  • Step 1 – Install Laravel 8 App
  • Step 2 – Configure Database With App
  • Step 3 – Configure Google App
  • Step 4 – Install Socialite & Configure
  • Step 5 – Add Field In Table Using Migration
  • Step 6 – Install Jetstream Auth
  • Step 7 – Make Routes
  • Step 8 – Create Google Login Controller By Command
  • Step 9 – Integrate Google Login Button In Login Page
  • Step 10 – Start Development Server

Step 1 – Install Laravel 8 App

First of all we need to create a fresh laravel project, download and install Laravel 8 using the below command

Step 2 – Configure Database With App

Now, lets create a MySQL database and connect it with laravel application. After creating database we need to set database credential in application’s .env file.

Step 3 – Configure Google App

In this step, we will configure Google app with this laravel app. So, open your laravel Google social login project in any text editor. Then navigate the config directory and open service.php file and add the client id, secret and callback url:

Step 4 – Install Socialite & Configure

In this step we will Install Socialite Package via Composer using following command:

Now, Navigate to config directory and open app.php file. Then add aliese and provider app.php:

Then add the Facade in config/app.php:

Step 5 – Add Field In Table Using Migration

Now, we will create migration to add social login field using following command:

After that, open the add_social_login_field.php file, which is found inside database/migration directory and add the following code into it:


After successfully add field in database table. Then add fillable property in User.php model, which is found inside app/Models/ directory:


After that, execute the following command on cmd to create tables into your selected database:

Step 6 – Install Jetstream Auth

In this step, install jetstream laravel auth scaffolding package with livewire. We have provided a complete guide in this Laravel 8 Auth Scaffolding using Jetstream Tutorial.

Step 7 – Make Routes

After this, we need to define routes in “routes/web.php” file. Lets open “routes/web.php” file and add the following routes in it.

routes/web.php

Step 8 – Create Google Login Controller By Command

In this step, run following command to create GoogleSocialiteController.php file:

Now, go to app/http/controllers directory and open GoogleSocialiteController.php file in any text editor. Then add the following code into GoogleSocialiteController.php file:

Step 9 – Integrate Google Login Button In Login Page

In this step, integrate google login button into login.blade.php file. So, open login.blade.php, which is found inside resources/views/auth/ directory:

Step 10 – Start Development Server

Now we are ready to run our example so lets start the development server using following artisan command –

Now, open the following URL in browser to see the output –

How to Use Helper Function in Laravel 8

In this How to Create Custom Helper In Laravel tutorial I will show you how to create custom helper in laravel. In this tutorial you will learn to create custom helper file in laravel. With custom helper file you can define functions that you can reuse in your laravel application.

What Laravel Custom Helper

In laravel, custom helper file helps you to reduce the re-writing the same code again and again. With custom helper file you can define the custom helper functions that you can use anywhere in your laravel project.

How to Create Custom Helper In Laravel 8

In this step by step tutorial I demonstrate you how to create custom helper file in laravel project. I will also show you how to define custom helper function and to call them in laravel application:

Create helpers.php File

In custom helper file you can define your own functions and call anywhere in your laravel  project. Go to App directory and create a new file helpers.php like this app/helpers.php.

 

Add File Path In composer.json File

In this step, we will add helper file path in composer.json file. Go to root directory and open composer.json file and put the following code into the file:

composer.json

Run Command for autoloading

Now, go to command prompt and type the given command:

How to use helper function in laravel 8

Now, you will learn how to call or use custom helper function in laravel 8:

1 – How to call helper function in laravel blade

2 – How to call helper function in laravel controller

Laravel 8 Send Email Example

In this tutorial we will learn how to send email in laravel 8 using mailable and mailtrap. We will use Laravel 8 builtin mailable markdown class to send emails. In order to send email using mailtrap we will implement laravel 8 builtin mailable markdown class. In this post I’ll show you how to integrate mailtrap to send email in laravel 8 application.

Laravel 8 provides builtin mailable markdown class to send emails. In Laravel 8 you can use mailtrap, smtp, Mailgun, Postmark, Amazon SES, and sendmail for sending emails. You are required to configure driver details on the .env file.

Laravel 8 Send Email Example

In this step by step tutorial you will understand how to send emails in Laravel 8 with the help of Mailtrap. We will explain to you how to use Laravel 8 builtin mailable markdown class to send emails using Mailtrap.

Install Laravel Project

First of all we need to create a fresh laravel project, download and install Laravel 8 using the below command

Adding Mail Configuration in ENV

In this step we will be setting smtp detail for mail configuration in Laravel, We will be using following Gmail SMTP details such as username, password inside the .env file.

If we are sending email from localhost using Gmail SMTP, then it requires you to turn on the “Allow less secure apps” on?. Go to the link provided:

Now, You need to turn on the option “Allow less secure apps”

Define Markdown with Mailable Class

The mailable class in Laravel used for sending emails. Now, lets create a new laravel mailable class using following artisan command:

Once the above command executed, it will create a new laravel mailable class OfferMail.php in app/Mail/ directory. Open the OfferMail.php file and put the following code in it.

Create and Organize Controller

Now, we will create a controller that will handle the logic to send email. Let’s create MailController Controller using following command:

Once the above command executed, it will create a controller file MailController.php in app/Http/Controllers/ directory. Open the MailController.php file and put the following code in it.

Controllers/MailController.php

Define Route

After this, we need to define routes in “routes/web.php” file. Lets open “routes/web.php” file and add the following routes in it.

routes/web.php

Create Email Template

In this step, we will create view/blade file to setup email template. Open resources/views/emails/offerSendMail.blade.php file, put the following code.

resources/views/emails/offerSendMail.blade.php

Run Development Server

Now we are ready to run our example so lets start the development server using following artisan command –

Now, open the following URL in browser to see the output –

Multiple File Upload using Ajax in Laravel 8

In this Multiple File Upload using Ajax in Laravel 8 tutorial, I’ll show you how to upload multiple files using ajax in laravel 8. In this laravel 8 multiple file upload example, I’ll show you how to validate and upload multiple files into folder and then save it into database. In this tutorial before saving multiple image into database we will validate image and then save it into directory. Before uploading the image we will validate the image. After successfully uploading multiple images into the folder and saving it in database we will display success message on the screen.

Multiple File Upload using Ajax in Laravel 8

In this step by step tutorial I’ll demonstrate how to upload multiple files using ajax in laravel 8 with validation. I’ll also show you how to upload multiple pdf, txt, csv, excel, doc files in laravel 8 application. Please follow the steps to upload multiple files in laravel 8 given below:

  • Step 1 – Install Laravel 8 Application
  • Step 2 – Database Configuration
  • Step 3 – Build File Model & Migration
  • Step 4 – Create Ajax Multiple File Upload Routes
  • Step 5 – Make Controller using Artisan Command
  • Step 6 – Create an Ajax Form to Upload Multiple File
  • Step 7 – Ajax Code to Upload Multiple File
  • Step 8 – Start Development Server

Step 1 – Install Laravel 8 Application

First of all we need to create a fresh laravel project, download and install Laravel 8 using the below command

Step 2 – Database Configuration

Now, lets create a MySQL database and connect it with laravel application. After creating database we need to set database credential in application’s .env file.

Step 3 – Build File Model & Migration

Now, in this step we will create model and migration file. Please run the following command:

The above command will create two files:

  • blog/app/Models/File.php
  • blog/database/migrations/create_files_table.php

Open create_files_table.php file inside blog/database/migrations/ directory. Then open this file and add the following code into function up() on this file:

Now, in this step we will create model and migration file. Please run the following command:

Step 4 – Create Ajax Multiple File Upload Routes

After this, we need to define routes in “routes/web.php” file. Lets open “routes/web.php” file and add the following routes in it.

routes/web.php

Step 5 – Make Controller using Artisan Command

Now, lets create a controller named AjaxUploadMultipleImageController using command given below –

The above command will create AjaxUploadMultipleImageController.php file, which is located inside blog/app/Http/Controllers/ directory. Now, open UploadImagesController.php file and add the following code into it:

Step 6 – Create an Ajax Form to Upload Multiple File

In step this we will create blade file. Go to resources/views directory. And then create a new blade view file named multi-file-ajax-upload.blade.php inside this directory. Open multi-file-ajax-upload.blade.php file and put the following code into it:

Step 7 – Ajax Code to Upload Multiple File

Step 9 – Start Development Server

Now we are ready to run our example so lets start the development server using following artisan command –

Now, open the following URL in browser to see the output –

Laravel 8 Multiple Image Upload Via API

In this Laravel 8 multiple image file upload via API tutorial I will show you how to upload multiple image file via api in laravel 8. In this tutorial we will learn to upload multiple images using api in laravel 8. We will also learn to create api to upload images in laravel 8.

While working with laravel application we come to situation when we want to upload multiple image file using rest api. We may also want to validate files or images before uploading to server via API or ajax in laravel 8. In this article we will learn to create rest api to upload multiple image in laravel 8.

Laravel 8 Multiple Image Upload Via API

In this step by step tutorial I will show you how to upload multiple image file via API using postman in laravel 8 application.

  • Step 1: Install Laravel 8 App
  • Step 2: Database Configuration with App
  • Step 3: Make Migration & Model
  • Step 4: Make Api Routes
  • Step 5: Generate API Controller by Artisan
  • Step 6: Run Development Server
  • Step 7: Laravel Multiple Image File Upload Via Api Using PostMan

Step 1: Install Laravel 8 App

First of all we need to create a fresh laravel project, download and install Laravel 8 using the below command

Step 2: Add Database Credentials

Now, lets create a MySQL database and connect it with laravel application. After creating database we need to set database credential in application’s .env file.

Step 3: Make Migration & Model

Now, in this step we will create model and migration file. Please run the following command:

The above command will create a model name file and a migration file for the Images table. Now, go to database/migrations folder and open create_images_table.php. Then put the following code into create_images_table.php:

Now, in this step we will create model and migration file. Please run the following command:

Step 4: Make API Route

After this, we need to define routes in “routes/api.php” file. Lets open “routes/api.php” file and add the following routes in it.

routes/api.php

Step 5: Generate API Controller by Artisan

Now, lets create a controller named MultipleUploadController using command given below –

The above command will create a controller named MultipleUploadController.php file. Now app/http/controllers/API folder and open MultipleUploadController.php. Then update the following file uploading methods into your MultipleUploadController.php file:

Step 6: Run Development Server

Now we are ready to run our example so lets start the development server using following artisan command –

Step 7: Laravel Multiple Image File Upload Via Api Using PostMan

Now start postman and use the following URL to upload multiple image files via api in laravel 8 app:

Laravel 8 Send Mail using Queue Tutorial

In this tutorial Laravel 8 Send Mail using Queue Tutorial I will show you how to send mail using queue in laravel 8. In this tutorial you will learn to send mails using queue job In laravel application. In Laravel 8 you can use mailtrap, smtp, Mailgun, Postmark, Amazon SES, and sendmail for sending emails.

When we want to send mails in bulk it takes enough time to send all mails. Sending mails in bulk result time consuming process and may not guarantee all mails being sent. In laravel we can use queue job for sending mail in bulk. In this example we will create a queue job with database driver for sending emails.

Laravel 8 Send Mail using Queue Tutorial

In this step by step tutorial I will demonstrate you how to send mail using queue job In laravel application. Please follow instructions given below:

  • Step 1 – Install Laravel 8 App
  • Step 2 – Configuration SMTP & Database
  • Step 3 – Create Mailable Class
  • Step 4 – Add Email Send Route
  • Step 5 – Create Directory And Mail Blade View
  • Step 6 – Configuration Mail Queue
  • Step 7 – Build Queue Job For Sending Mail
  • Step 8 – Run Development Server

Step 1 – Install Laravel 8 App

First of all we need to create a fresh laravel project, download and install Laravel 8 using the below command

Step 2 – Configuration SMTP & Database

In this step we will be setting smtp detail for mail configuration in Laravel, We will be using following Gmail SMTP details such as username, password inside the .env file.

Step 3 – Create Mailable Class

The mailable class in Laravel used for sending emails. Now, lets create a new laravel mailable class using following artisan command:

Once the above command executed, it will create a new laravel mailable class NotifyMail.php in app/Mail/ directory. Open the NotifyMail.php file and put the following code in it.

Now add email template name in build class of the above created notifymail class.


In next step, Create email template named demoMail.blade.php inside resources/views/emails directory. That’s why have added view name email.

Step 4 – Add Send Email Route

After this, we need to define routes in “routes/web.php” file. Lets open “routes/web.php” file and add the following routes in it.

routes/web.php

Step 5 – Create Directory And Mail Blade View

In this step, create directory name emails inside resources/views directory. Then create an demoMail.blade.php blade view file inside resources/views/emails directory. And update the following code into it:

Step 6 – Configuration Mail Queue

Then open the terminal and run following command for queue database tables:

Next, migrate tables into database:

Step 7 – Build Queue Job For Sending Mail

Now we will create a queue job to send emails using following artisan command:

Then open SendEmailJob.php file which is placed on “app/Jobs” directory. And update the following mail queue code into it:

Step 8 – Run Development Server

Now we are ready to run our example so lets start the development server using following artisan command –

Now, open the following URL in browser to see the output –

Laravel 8 Telescope Example Tutorial

In this Laravel 8 Telescope Example Tutorial I will show you how to install and configure telescope in laravel 8. In this tutorial you will learn to install and use telescope in laravel 8. Laravel Telescope can be used to debug requests, exceptions, databases, cache, and much more in real-time by accessing a specific route in your local or production environment in laravel 8 project.

Laravel 8 Telescope Example Tutorial

In this step by step Laravel 8 Telescope Example Tutorial you will learn to install, configure and use telescope in laravel 8. Please follow instruction given below:

Step 1 – Install Telescope

In this step you are required to switch to project directory and then run the following command to install telescope in laravel 8 app:

If you want to use telescope in local environment, so you can use the below command:

Step 2 – Migrate Tables

Now, run following command to migrate database schema.

Step 3 – Configure Telescope

Now we need to configure Telescope, please follow instruction

After that, open AppServiceProvider.php file, which is located inside app/providers directory and add the following lines of code into register() method:

Step 4 – Configure Dashboard Authorization

Telescope exposes a dashboard at /telescope. You can access this dashboard in the local environment. Go to app/Providers/TelescopeServiceProvider.php file, there is a gate method. This authorization gate controls access to Telescope in non-local environments. From here you can modify this gate as needed to restrict access to your Telescope installation:

Step 5 – Start Development Server

Now we are ready to run our example so lets start the development server using following artisan command –

Step 6 – Test Laravel Telescope

Now, open the following URL in browser to see the output –

How to Create Controller Model in Laravel 8 using cmd

In this Create Controller And Model Laravel 8 Using Command tutorial I will show you how to Create Controller And Model Using Command In laravel. In this tutorial you will learn to create or generate controller and model using command in laravel. In this article we will learn about laravel artisan command to create controller and model. In this article I will demonstrate you with example to create controller and model using laravel command.

How to Create Controller Model in Laravel 8 using cmd

In this step by step tutorial I will show you how to create or generate controller and model using command in laravel. Please follow the instructions given below:

  • 1 – Create model command
  • 2 – Create Controller command
  • 3 – Create a Resource Controller Command
  • 4 – Laravel make:model with migration and controller
  • 5 – Create Model and Migration
  • 6 – Create API Controller using Artisan
  • 7 – Laravel create model and controller in one command

1 – Create model command

Below is example command to create laravel model. Please  Use the php artisan make model for creating a model using the command line (CLI) :

2 – Create Controller command

Below is example command to create laravel controller. Please  Use the php artisan make controller for creating a controller using the command line (CLI) :

This command will create controller named ProductController, Which is placed on app/http/controllers directory.

3 – Create a Resource Controller Command

Below is example command to create a resource controller. Please  Use the php artisan make controller with –resource option for creating a resource controller:

4 – Laravel make:model with migration and controller

The below command will create model, migration and controller in one command:

5 – Create Model and Migration

The below command will create model and migration in one command:

6 – Create API Controller using Artisan

The below command will create API\controller:

7 – Laravel create model and controller in one command

The below command will create model and controller in one command:

Laravel 8 Autocomplete Search from Database Tutorial

In this Laravel 8 Autocomplete Search using Jquery UI tutorial I will show you how to create autocomplete input or search box using jquery ui in laravel 8. In this tutorial you will learn to create autocomplete input box using jquery ui in laravel 8. In this article we will be creating dynamic database driven ajax jquery autocomplete in Laravel.

In this example we will be using autocomplete jquery ui plugin. The jquery autocomplete plugin is used to create dynamic autocomplete input with several options. In this example you will learn how to implement jquery autocomplete in laravel.

Laravel 8 Autocomplete Search from Database Tutorial

In this article, I will show you to create a dynamic database driven ajax jquery autocomplete in Laravel 8. You will also learn to create a dynamic search dropdown autocomplete which will fetch options from database table using jquery autocomplete.

  • Step 1 – Install Laravel 8 App
  • Step 2 – Database Configuration Database
  • Step 3 – Make Model and Migration
  • Step 4 – Make Routes
  • Step 5 – Create Controller
  • Step 6 – Create Blade View
  • Step 7 – Implement jQuery Ajax Code
  • Step 8 – Run Development Server

Step 1 – Install Laravel 8 App

First of all we need to create a fresh laravel project, download and install Laravel 8 using the below command

Step 2 – Database Configuration Database

Now, lets create a MySQL database and connect it with laravel application. After creating database we need to set database credential in application’s .env file.

Step 3 – Make Model and Migration

Now, in this step we will create model and migration file. Please run the following command:

Now, open product.php file and add the following code into it, which is placed on app/model directory:

After that, open create_products_tables.php and add the following code into it, which is placed on database/migration directory:

Step 4 – Create Routes

After this, we need to define routes in “routes/web.php” file. Lets open “routes/web.php” file and add the following routes in it.

routes/web.php

Step 5 – Create Controller

Now, lets create a controller named AutoCompleteController using command given below –

Then open AutoCompleteController.php and put the following code into this file, which is placed on app/http/controllers directory:

Step 6 – Create Blade View

In this step we will create blade file, Go to resources/views directory and create blade view file name autocomplete-search.blade.php. Then put the following code into autocomplete-search.blade.php:

Step 7 – Implement jQuery Ajax Code

Then add the following code in auto.js file:

Step 8 – Run Development Server

Now we are ready to run our example so lets start the development server using following artisan command –

Now, open the following URL in browser to see the output –

Laravel 8 Livewire CRUD with Jetstream Example

In this Laravel 8 Livewire CRUD with Jetstream Example tutorial I will show you how to create simple CRUD Application using jetstream auth with livewire in laravel 8. In this tutorial, you will learn to create a simple CRUD (Create, Read, Update and Delete) application with jetstream auth and livewire in Laravel 8. In this Laravel 8 CRUD operation example tutorial I’ll show you how to create a simple crud application with jetstream auth and livewire  in laravel 8. In this example we will learn how to create a simple crud operation application in laravel 8. In this article, you will learn how to create fully functional CRUD (Create, Read, Update and Delete) application with jetstream auth and livewire  in laravel 8.

Laravel 8 Livewire CRUD with Jetstream Example

In this tutorial, you will learn step by step how to build simple crud operation app in laravel 8. You will also learn to create a simple CRUD application with jetstream auth and livewire in Laravel 8.

  • Step 1 – Download Laravel 8 App
  • Step 2 – Connect Laravel 8 App To Database
  • Step 3 – Make Model & Migration
  • Step 4 – Install Jetstream Auth with Livewire
  • Step 5 – Build Todos Livewire Components
  • Step 6 – Create Routes
  • Step 7 – Update Todo Component File
  • Step 8 – Create And Update Blade Files
  • Step 9 – Start Development Server

Step 1 – Download Laravel 8 App

First of all we need to create a fresh laravel project, download and install Laravel 8 using the below command

Step 2 – Connect Laravel 8 App To Database

Now, lets create a MySQL database and connect it with laravel application. After creating database we need to set database credential in application’s .env file.

Step 3 – Make Model & Migration

Now, in this step we will create model and migration file. Please run the following command:

Now, open create_todos_table.php file inside Laravel8CRUD/database/migrations/ directory. Then put the function up() with following code:

Then add the fillable property in Todo.php, which is placed on app/models direcotry:

Step 4 – Install Jetstream Auth with Livewire

In this step, we will install Jetstream Package via the composer dependency manager. Use the following command to install Jetstream.

After that, execute the following command on terminal to install livewire package in laravel 8 app:

Then, execute the “npm install && npm run dev” command to build your assets:

To run npm:

Then, Execute the following command on the terminal to create tables into the database:

Step 5 – Build Todos Livewire Component

Now, we will create a livewire compoent using following command:

This command will create two files, which is located on following path:

Step 6 – Create Routes

After this, we need to define routes for crud operations in “routes/web.php” file. Lets open “routes/web.php” file and add the following routes in it.

routes/web.php

Step 7 – Update Todo Component File

Now, update the Todo.php component file with the following code, which is placed on app/Http/Livewire directory:

Step 8 – Create And Update Blade Files

In this step we will create blade view files for crud operations. Lets open todos.blade.php file and update the following code into it, which is placed on resources/views/livewire directory:

Then create one new blade view file name create.blade.php inside resources/views/livewire directory. And update the following code into it::

Step 9 – Start Development Server

Now we are ready to run our example so lets start the development server using following artisan command –

Now, open the following URL in browser to see the output –

Laravel 8 Login with Linkedin Example Tutorial

In this Laravel 8 Login with Linkedin Example Tutorial I’ll show you how to integrate socialite LinkedIn social login in laravel 8 application. In this tutorial you will learn to integrate LinkedIn login in laravel. In this article we will integrate login  with LinkedIn in laravel application.

As we all know that users are not much interested in filling up long registration form to register with any application. Allowing users to login with their social media accounts is quick and powerful way to get registered/verified users for your laravel application. Allowing users to login with their social media accounts makes registration/login process much easier, it also encourages more users to register for your application. In this step by step tutorial, you will learn to integrate linkedin login with your laravel application.

Laravel 8 Login with Linkedin Example Tutorial

This tutorial is step by step guide for you on how to integrate linkedin social login in laravel 8 using socialite package.

Step 1:- create linkedin app by click the following url :- https://www.linkedin.com/developers/apps/new . And create linkedin app.

Step 2:- After successfully create the app set the redirect URL for example :

Step 3:- Finally, you redirect to dashboard by linkedin.com. So you can copy client id and secret from linkedin app dashboard.

  • Step 1 – Install Laravel 8 App
  • Step 2 – Connecting App to Database
  • Step 3 – Configure the Linkedin App
  • Step 4 – Install Socialite & Configure
  • Step 5 – Add Field In Table Using Migration
  • Step 6 – Install Jetstream Auth
  • Step 7 – Make Routes
  • Step 8 – Create Linkedin Login Controller By Command
  • Step 9 – Integrate Linkedin Login Button In Login Page
  • Step 10 – Start Development Server

Step 1 – Install Laravel 8 App

First of all we need to create a fresh laravel project, download and install Laravel 8 using the below command

Step 2 – Connecting App to Database

Now, lets create a MySQL database and connect it with laravel application. After creating database we need to set database credential in application’s .env file.

Step 3 – Configure Linkedin App

In this step, we will create linkedin app for client and secret key, go to following link

Now create linkedin app filling the details and create your linkedin app. After creating the app set the redirect URL. Now, copy the client id and secret from linkedin app dashboard.Now, configure Linkedin app with this laravel app. So, open your laravel Linkedin social login project in any text editor. Then navigate the config directory and open service.php file and add the client id, secret and callback url:

Step 4 – Install Socialite & Configure

In this step we will Install Socialite Package via Composer using following command:

After Installing ‘socialite’ package, we need to add service provider and alias in config/app.php file as following.

config/app.php

 

Then add the Facade in config/app.php:

Step 5 – Add Field In Table Using Migration

Now, we will create a migration file to add social login fields using following command:

Now, open the add_social_login_field.php file, which is found inside database/migration directory and add the following code into it:


After successfully add field in database table. Then add fillable property in User.php model, which is found inside app/Models/ directory:


Now, in this step we will create model and migration file. Please run the following command:

Step 6 – Install Jetstream Auth

In this step, install jetstream laravel auth scaffolding package with livewire. We have provided a complete guide in this Laravel 8 Auth Scaffolding using Jetstream Tutorial.

Step 7 – Make Routes

After this, we need to define routes in “routes/web.php” file. Lets open “routes/web.php” file and add the following routes in it.

routes/web.php

Step 8 – Create Linkedin Login Controller By Command

In this step, run the following command to create LinkedinSocialiteController.php file:

Now, go to app/http/controllers directory and open LinkedinSocialiteController.php file in any text editor. Then add the following code into LinkedinSocialiteController.php file:

Step 9 – Integrate Linkedin Login Button In Login Page

In this step, integrate linkedin login button into login.blade.php file. So, open login.blade.php, which is found inside resources/views/auth/ directory:

Step 10 – Start Development Server

Now we are ready to run our example so lets start the development server using following artisan command –

Now, open the following URL in browser to see the output –