Category Archives: Blog

Blog

Laravel 7/6 Send Email Tutorial Example

In this Laravel 7/6 Send Email Tutorial I will show you how to send email in laravel. In this tutorial you will learn how to send email in laravel using SMTP driver. Laravel comes with built-in api and driver support for SMTP, SendMail, Mailgun, Sendgrid, Mandrill, Amazon SES, SpartPost etc. In this article I will share example of sending an email in laravel application.

Laravel 7/6 Send Email Tutorial Example

In this step by step tutorial you will understand how to send emails in Laravel using SMTP driver.

  • Install Laravel Setup
  • Configuration SMTP in .env
  • Create Route & Blade View
  • Create Controller & Method
  • Run Development Server

1. Install Laravel Fresh Setup

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

2. Configuration SMTP in .env

In this step we will configure smtp settings in .env file as following:

3. Create Route & Blade View

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

Next, we will create email blade view file in view folder of view. Go to the resources/views/ and create a view file name email.blade.php. Put bellow code:

4. Create Controller & Method

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

Now open the controller let’s go to app/Http/Controllers/EmailController.php. Put the following code in it:

5. 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 7/6 Ajax CRUD Example

In this Laravel 7/6 Ajax CRUD operation example tutorial I’ll show you how to create a simple ajax crud application in laravel 7/6. In this example we will learn how to create a simple ajax crud operation application in laravel 7/6. In this laravel 7/6 ajax crud application we will be using jQuery and ajax to delete data from datatable crud app and MySQL database in laravel 7/6 app.

In this tutorial, you will learn to implement ajax based CRUD (Create, Read, Update and Delete) operations in laravel.

Laravel 7/6 DataTable Ajax CRUD Example Tutorial

In this step by step guide, we will be creating a simple laravel 7/6 application to demonstrate you how to implement ajax based CRUD operations in laravel.

Laravel 7/6 Ajax CRUD Example

  • First Install New Laravel Setup
  • Configure .env file
  • Create One Model and Migration
  • Make Route
  • Generate(create) Controller
  • Create Blade View
  • Start Development Server
  • Conclusion

1). First Install New Laravel Setup

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

2). Configure .env file

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.

Next go to app/datatabase/migrations and open users migration file and put the below code here

Now, go to app/providers/AppServiceProvider.php and put the below code :

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

3). Make 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

4). Generate (Create) Controller

In this step we will create a resource controller named AjaxController for crud operations using following command:

Next open your controller and replace crud methods as following:

5). Create blade view :

In this step, we will create one blade file name ajax-crud.blade.php.

Next step, we will create one modal. After create a modal it put closing of last div tag :


Next we will implement the ajax crud logic inside the script. Open your ajax-crud blade view file and put the below code after closing of body tag

6). 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 7/6 Generate PDF Example

In this Laravel 7/6 Generate PDF Example tutorial, I will show you how to generate pdf from html blade view file in laravel. In this tutorial you will learn to generate, convert and download pdf file from html blade view file in laravel. While working with web application we come to situations where we need to generate or download pdf file for various purpose such as generate invoices, acknowledgment or tickets printing etc. In this tutorial we will be using laravel dom-pdf package to generate/create and download pdf.

Laravel 7/6 Generate PDF Example

In this step by step guide I will demonstrate you how to create or download pdf from laravel html blade view file in the laravel 7/6 Application.

  1. Install Laravel App
  2. Setup Database
  3. Install laravel-dompdf Package
  4. Make PDF Route
  5. Create GeneratePDF Controller
  6. Create Blade view for Generate Pdf
  7. Start Development Server

1. Install Laravel App

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

2. Setup 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.

3. Install laravel-dompdf Package

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

After successfully installing laravel dompdf package, we need to add service provider and alias in config/app.php file as following.

4. Make PDF 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

5. Create GeneratePDF Controller

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

After creating controller go to app/controllers/GeneratePdfController.php and put the following code in it:

 

6. Create Blade view for Generate Pdf

Now, we need to create blade view file. Go to app/resources/views and create one file name pdf_form.blade.php :

Now we create a one more blade view file name pdf_download.blade.php. Go to app/resources/views create file. This blade view file will download as pdf file. so put the below code here

7. 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 7/6 Simple CRUD Application Example Tutorial

In this Laravel 7/6 Simple CRUD Application Example Tutorial I’ll show you how to create a simple crud application in laravel 7/6. In this example we will learn how to create a simple crud operation application in laravel 7/6. In this laravel 7/6 crud application we will be using jQuery and ajax to delete data from datatable crud app and MySQL database in laravel 7/6 app. In this article, you will learn how to create fully functional CRUD (Create, Read, Update and Delete) Application In laravel.

Laravel 7/6 Simple CRUD Application Example Tutorial

  • Step 1: Install Laravel New Setup
  • Step 2: Setup Database Credentials
  • Step 3: Generate Model and Migration
  • Step 4: Add Routes for CRUD Operation
  • Step 5: Create Resource CRUD Controller
  • Step 6: Create the blade view
  • Step 7: Start Development Server

Step 1: Install Laravel New Setup

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

Step 2: Setup 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: Generate Model and Migration

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

The above command will create one model name Product and also create one migration file for Product table. Now, go to database/migrations file and put the below here :

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

If you found any query builder error in command prompt go to  => app\Providers\AppServiceProvider.php and put the below code here :

And then run this below command :

Now, add the fillable property inside Product.php file.

Step 4: Add Routes For CRUD Operation

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 Resource CRUD Controller

In this step we will create a resource controller using following artisan command:

The above command will create a contoller name ProductController and also inside by default seven methods like index, store, create, update, destroy, show, edit.

Next open controller, Go to app/HTTP/Controller/ProductController and update the below code into your controller file:

Step 6: Create the blade view

Create the product folder. After successfully create product folder , we will create following blade files for CRUD (Create, Retrieve, Update, Delete) operations.

  1. Layout.blade.php
  2. List.blade.php
  3. Create.blade.php
  4. Edit.blade.php
Layout.blade.php

List.blade.php

Create.blade.php

Edit.blade.php

Step 7: 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 7/6 DataTable Ajax CRUD Example Tutorial

In this Laravel 7/6 Datatables CRUD operation example tutorial I’ll show you how to create a simple crud application using yajra Datatables in laravel 7/6. In this example we will learn how to create a simple crud operation application using Datatables in laravel 7/6. In this laravel 7/6 crud application we will be using jQuery and ajax to delete data from datatable crud app and MySQL database in laravel 7/6 app.

In this tutorial, you will learn to implement ajax based CRUD (Create, Read, Update and Delete) operations using datatable js. In this tutorial, we will be using yajra datatable package for listing of records with pagination, sorting and filter (search) feature.

Laravel 7/6 DataTable Ajax CRUD Example Tutorial

In this step by step guide, we will be creating a simple laravel 7/6 application to demonstrate you how to install yajra datatable package and implement ajax based CRUD operations with datatable js.

  • Step 1: Install Fresh laravel Setup
  • Step 2: Set database Credentials
  • Step 3: Create Migration And Model
  • Step 4: Install Yajra DataTables in App
  • Step 5: Create Route, Controller & Blade View
  • Step 6: Run Development Server
  • Step 7: Live Demo

Step 1: Install Fresh Laravel Setup

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

Step 2: Set 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: Create Migration And Model

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

Now go to database/migrations/ and open create_products_table.php file. Then put the following code into this file:

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

The above command will create tables in your database. Now, go to App directory and open Product.php file and then update the following code to into Product.php file as follow

app\Product.php

Step 4: Install Yajra Datatables Package in Laravel

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

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

config/app.php

After set providers and aliases then publish vendor run by following command.

Step 5: Create (Controller, Route, Blade)

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

2: Create Controller

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

Now, open app/Http/Controllers/ProductController.php and create some methods to add products, edit product and delete the product. In Product Controller, we need to create some methods:

  • Index()
  • Store()
  • Edit()
  • Destroy()

Index() method

Store() Method

Edit() Method

Delete() Method

Now, update all methods into your ProductController.php file as follow:

3: Create Blade View

Create a Button view

Now, we will create action.blade.php file. This file contains a two-button name edit and delete. So you can update the below code in your action button file.

Next, create a list.blade.php file in resources/views/ folder and update the below code in your product list file.

Script Code

Step 6: 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 7/6 Paytm Payment Gateway Integration

In this Laravel 7/6 Paytm Payment Gateway Integration Example tutorial, I’ll show you how to integrate Paytm payment gateway in laravel 7/6. In this tutorial you will learn to integrate Paytm in laravel 7/6. In this step by step tutorial I’ll share laravel 7/6 Paytm integration example.

Paytm Payment Gateway

Paytm is one of the popular payment gateway, that allows us to accept payment from your customer. Paytm is very simple, hassle free and easy to integrate payment gateway. Integrating Paytm payment gateway in laravel 7/6 is a breeze.

Laravel 7/6 Paytm Payment Gateway Integration

In this tutorial, you will learn to integrate Paytm payment gateway in your laravel 7/6 project. Follow this step by step tutorial to learn Paytm payment gateway integration in laravel 7/6.

  • Install laravel fresh Setup
  • Configuration .env file
  • Install Anandsiddharth paytm package
  • Generate Migration and Create Model
  • Make Route
  • Create Controller
  • Create Blade View file
  • Start Development Server
  • Conclusion

Install laravel Fresh Project

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

Configuration in .env

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.

Install Anandsiddharth paytm package

Now, we need to install Anandsiddharth paytm package in our project. Open your terminal and switch to project directory and use the following composer command to install Anandsiddharth paytm package.

After installing the package, we need to register the provider and alias. Go to the app/config/app.php and put the below lines here :

Now we need to set a paytm credential as following. Go to the app/config/services.php and set the paytm credential

Generate Migration and Create 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 Event and also create a migration file for the events table. After that go to database/migrations file and put the below here :

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

Now, add the fillable property inside the Event.php file.

Make 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 Controller

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

Go to app/HTTP/Controller/EventController and put the below code :

Create Blade View file

Now, we need to create blade views file, Go to app/resources/views/ and create one file name event.blade.php :

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 –

http://localhost:8000/event

Testing Card Credential

Laravel 7/6 Generate Fake Data Using Faker Example

In this Laravel 7/6 Generate Fake Data Using Faker Example tutorial, I will show you how to generate fake data using laravel faker. In this tutorial you will learn to generate fake or dummy data in a database table using faker in laravel project. While working with any web application using laravel we come situations where we need some dummy or test data to available in database. Laravel faker makes this job much easier using laravel faker we can generate fake data into the database table.

Laravel 7/6 Generate Fake Data Using Faker Example

In this tutorial, you will learn how to generate fake data into the database tables using laravel faker. Please follow the instruction give below:

  • Step 1: Download Fresh Laravel Setup
  • Step 2: Setup Database Credential
  • Step 3: Run Migration Command
  • Step 4: Create a Model & Migration File
  • Step 5: Create New Factory File
  • Step 6: Generate Fake Data Using Tinker
  • Step 7: Generate Fake Data Using Seeder

Step 1: Download Fresh Laravel Setup

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

Step 2: Setup Database Credential

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: Run Migration Command

In this step we will run following command to migrate database schema.

Step 4: Create a Model & Migration File

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

Let’s go to the app/Notes.php and put the below code in your files.

Next, go to database/migrations/2019_02_19_012129_create_notes_table.php and replace the below code into your file.

Step 5: Create New Factory File

In this step, we will create a factory file. Go to app/database/factories and inside this folder, we need to create a new file name NoteFactory.php and put the below code into your file.

Step 6: Generate Fake Data Using Tinker

Please use the following command to generate fake data using tinker:

Now, run following command to generate 100 rows of random Notes.

Step 7: Generate Fake Data Using Seeder

Let’s create seeder for Note using below artisan command.

The above command will generate NoteTableSeeder.php file in the database/seeds directory. Open NoteTableSeeder.php and update code shown as below.

Next step, we will declare NoteTableSeeder inside the DatabaseSeeder. The file is DatabaseSeeder located app/database/seeds.

DatabaseSeeder.php

Now, run the following command to generate 100 fake rows in the Note table.

Please check the database now for test data.

Laravel 7/6 Socialite Google Login Example

In this Login with google in Laravel 7/6 example tutorial I’ll show you how to integrate google login in laravel 7/6 using socialite package. Integrating google login in Laravel 7/6 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 7/6 Socialite Google Login Example

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

  • Install laravel App
  • Add Database Details
  • Install Socialite Package For Google Login
  • Create Google App
  • Set Google App Details
  • Add Routes
  • Generate Auth Files By Artisan
  • Create Controller
  • Add Socialite Google Login Button In Blade Views
  • Run Development Server

Step1: Install laravel App

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

Step 2: Add Database Details

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 Socialite Package For Google Login

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:

Step 4: Create Google App

Step 1:-
Visit Google Developer Console. And create a new project
Step 2:-
Please fill up the required information.
Step 3:-
After creating new project you need to select the created projects on the top menu. Then click on OAuth consent screen and select the given option according to your requirement:
Step 4:-
Next, you need to provide your website URL, privacy policy URL, etc.
Step 5:-
Click on left side menu credentials then select OAuth client ID.
Step 6:-
After that, the below form will be apper. Please select Web application from application type options. Once you have select Web application option, then one form will appear on web page. Here you have to define Name and you have also define Authorized redirect URIs field and lastly click on Create button.
Step 7:-
Once you have click on the create button, then you can get your Client ID and your client secret key.

Step 5: Add Google App Details

Now, we need to add google app details with redirect url. So, go to the config directory and open service.php file. And add the google client id, secret and redirect url in service.php file:

After that, open User.php model and add the following properties into User.php model file:

Now, go to app/database folder and open create_users_table.php. And add the following code into your create_users_table.php file:

Before you run PHP artisan migrate command, Navigate to go to app/providers folder and open AppServiceProvider.php file. And add the following code into your AppServiceProvider.php file:

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

Step 6: Generate Auth File By Artisan

Install Laravel UI

Create Auth

NPM Install

Step 7: Add Routes

Now, you need to add routes in the web.php file. So navigate to routes folder and open web.php file. Then add the following routes into web.php file:

Step 8: Create Controller

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

Then go to app/controllers folder and open GoogleLoginController.php. And put the following code into your GoogleLoginController.php file:

Step 9: Add Socialite Google Login Button In Blade Views

Go to Resources/Views/Auth folder and open register.blade.php. Then add a laravel socialite google login button in register.blade.php file:

Next, go to Resources/Views/Auth folder and open login.blade.php. Then add a laravel socialite google login button in login.blade.php file:

Step 10: 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 –

Login with Facebook In Laravel 7/6 Example

In this Login with facebook in Laravel 7/6 example tutorial I’ll show you how to integrate facebook login in laravel 7/6 using socialite package. Integrating Facebook login in Laravel 7/6 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.

Login with Facebook In Laravel 7/6 Example

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

  • Step 1: Install Laravel New App
  • Step 2: Connect App to Database
  • Step 3: Download Socialite Package
  • Step 4: Create Facebook App
  • Step 5: Create Auth Scaffolding
  • Step 6: Add Route
  • Step 7: Create Controller By Artisan Command
  • Step 8: Add Facebook Login Button On Blade View
  • Step 9: Run Development Server

Step 1: Install Laravel New App

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

Step 2: Connect 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: Download Socialite Package

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

Step 4: Create Facebook App

Step 1:-
Go to Facebook’s developers site https://developers.facebook.com/ and log in with your Facebook account. There in Facebook developers Dashboard you have option to Create App. Lets create a Facebook Login App simply providing App Name and Contact Email.

Step 2:-
After creating the facebook app, go to setting->advanced and set redirect url

Step 3:-
Then, go to Facebook Login -> Settings and scroll down to “Valid OAuth Redirect URL” and set your callback URL

Step 4:-
After creating app, go to Settings -> Basic and get your newly created App ID and App Secret. Now, go to config directory and open service.php file and add the client id, secret and callback url:

Now, go to User.php model and add fillable property like below:

Now, go to database/migrations directory and open create_users_table.php. Then put the following code into it:

Before you run PHP artisan migrate command. Navigate to app/providers/ directory and open AppServiceProvider.php. Then add the following code into it:

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

Step 5: Create Auth Scaffolding

Install Laravel UI

Create Auth

NPM Install

Step 6: Add 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 7: Create Controller By Artisan Command

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

Now, go to app/http/controllers/ directory and open SocialController.php. Then put the following code into your SocialController.php file

Step 8: Add Facebook Login Button On Blade View

In this step, you need to add Facebook login button in blade views file. Now, go to resources/views/Auth directory and open login.blade.php. Then put Facebook social login button in login.blade.php file

Now, go to resources/views/Auth directory and open register.blade.php. Then add Facebook social login button in register.blade.php file:

Step 9: 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 7/6 socialite Github Login Example

In this Login with Github in Laravel 7/6 example tutorial I’ll show you how to integrate Github login in laravel 7/6 using socialite package. Integrating Github login in Laravel 7/6 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 7/6 socialite Github Login Example

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

  1. Install Laravel App
  2. Configure Database Detail
  3. Create Github App
  4. Add Github App Detail
  5. Install Socialite Package For Github Login
  6. Add Fillable Property in Model
  7. Add fields Into User Migration File
  8. Run Table Migration Command
  9. Create Auth Files By Artisan
  10. Add Routes
  11. Create Controller
  12. Add Github Auth Button On Laravel View
  13. Start Development Server
  14. Laravel 7, 6 Socialite GitHub Login App Looks Like

Step 1: Install Laravel App

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

Step 2: Configure Database Detail

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: Create Github App

In this step we will create github App for github social login. Use the link provided to create twitter app.

Here you have to click New Auth APP button to Create your app. After this you need to register a new OAuth application page will open. So fill your app detail and submit it, Finally, you will see dashboard of your created github app. Now, copy your github app details.

Step 4: Add Github App Detail

In this step, add GitHub app details into service.php file. Go to config directory and open service.php file. Then add the client id and secret got from github app into service.php file:

Step 5: Add Fillable Property in Model

Now, go to app folder and open User.php Model file update fillable property like following:

app/User.php

Step 6: Add fields Into User Migration File

In this step, go to database/migrations directory and open create_users_table.php file. Then add following code into create_users_table.php file to add some fields into users table

Step 7: Run Table Migration Command

Now, Navigate to app/providers directory and inside this directory find AppServiceProvider.php file and open it in any text editor. Then add the following code in AppServiceProvider.php file:

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

Step 8: Install Socialite Package

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

Step 9: Create Auth Files By Artisan

Install Laravel UI

Create Auth

NPM Install

Step 10: Add 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 11: Create Controller

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

After that, go to app/http/controllers directory and open GithubSocialController.php file. Then put the following code into GithubSocialController.php file:

Step 12: Add Github Auth Button On Laravel View

Now, go to resources/Views/Auth/ directory and open register.blade.php. After that, add the github login button into register.blade.php file:

So, navigate to resources/Views/Auth/ directory and open login.blade.php in any text editor. After that, add the github login button into login.blade.php file:

Step 13: 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 7 Eloquent Join Example Tutorial

In this Laravel 7 eloquent join example tutorial I will show you how many types of join and subquery join in laravel you will also learn to use laravel join with eloquent queries. In this tutorial you will learn about various joins in laravel eloquent model. In this article I’ll demonstrate the use of various types of laravel joins.In this step by step laravel join tutorial I will share example of laravel eloquent join (join, left join, right join, cross join, and advance join) and subquery join.

Laravel 7 Eloquent Join Example Tutorial

In this Laravel 7 Eloquent Join Example Tutorial we will learn about following laravel eloquent join query with examples:

  1. Laravel Join Eloquent
  2. Laravel Left Join / Right Join Eloquent
  3. Laravel Cross Join Eloquent
  4. Laravel Advanced Join Eloquent
  5. Sub-Query Joins

In laravel model when you want to fetch data from multiple table with associated relationship In that case you can fetch data using laravel joins. In laravel as per the need we have to use left join(), right join(), cross join() or to join two or multiple table.

1: Laravel Join Eloquent

In laravel if we join two tables it selects records if the given column values matching in both tables. It’s also known as laravel inner join eloquent.  Let’s say you have two tables, users and posts. Both have ID columns, and there is a user_id in the post, which is a foreign key for the users’ table.’

2: Laravel Left Join / Right Join Eloquent

Left Join Eloquent

Laravel left join query returns all rows from the left table, even if there is no matches in the right table. When you are using laravel left join eloquent with a query builder laravel left join fetch data from the left table. Even if there is no match in the right table.

Right Join Eloquent

Laravel right join query returns all rows from the right table, even if there is no matches in the left table. When you are using laravel right join eloquent with a query builder laravel right join fetch data from the right table. Even if there is no match in the left table.

3: Laravel Cross Join Eloquent

In laravel, the cross join selects every row from the first table with every row from the second table.

4: Laravel Advanced Join Eloquent

If in join query add some addition criteria with where clause it termed as advance join query.

5: Laravel Sub-Query Eloquent

In this laravel join example we are using join query in sub query.

 

Laravel 7/6 Instamojo Payment Gateway Integration Example

In this Laravel 7/6 Instamojo Payment Gateway Integration Example tutorial I will show you How to Integrate Instamojo Payment Gateway in Laravel 7/6. In this tutorial, we will learn how to integrate the instamojo payment gateway in the php laravel application via the instamojo PHP package.

In this step by step tutorial I will demonstrate you to integrate instamojo payment gateway in the laravel app without using curl APIs. We will simply install instamojo PHP package and integrate into our lastest laravel based application.

Instamojo Payment Gateway

Instamojo is one of the popular payment gateway, that allows us to accept payment from your customer. Instamojo is very simple, hassle free and easy to integrate payment gateway. Integrating Instamojo payment gateway in laravel 7 is a breeze. Instamojo processes refund payments, collect a payment, create payment are very easy and simple.

Laravel 7/6 Instamojo Payment Gateway Integration Example

In this tutorial, you will learn to integrate Instamojo payment gateway in your laravel 7 project. Follow this step by step tutorial to learn Instamojo payment gateway integration in laravel 7.

  • Install Laravel Fresh Setup
  • Install Instamojo PHP package
  • Configuration .env file
  • Create Controller
  • Make Route
  • Create Blade View file
  • Start Development Server

Step 1: Install Laravel Fresh Project

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

Step 2: Install Instamojo PHP package

In this step, we will install Instamojo PHP package via the composer dependency manager. Use the following command to install Instamojo PHP package.

Step 3: Configuration in .env

Now, we will put following configuration detail in .env file:

Next, Go to the app/config/services.php and put the below code here.

Step 4: Create Controller

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

Go to app/Http/Controller/PayController and put the below code :

Step 5: Make 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 6: Create Blade View file

Now, we will create blade views file, Go to app/resources/views/ and create one file name event.blade.php :

Step 7: 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 –

Testing Card Credential