Category Archives: Laravel

Laravel Tutorials

Razorpay Payment Gateway Integration in Laravel 8 Tutorial

In this Razorpay Payment Gateway Integration in Laravel 8 Tutorial, I’ll show you how to integrate Razorpay in laravel 8 to collect payment. In this tutorial you will learn to integrate Razorpay in laravel 8. In this article I will share example to integrate Razorpay Payment Gateway in laravel 8 application.

Razorpay Payment Gateway

Razorpay is one of the popular payment gateway, that allows us to accept payment from your customer. Razorpay is very simple, hassle free and easy to integrate payment gateway. Integrating Razorpay payment gateway in laravel 8 is a breeze. Before starting with this tutorial you would require a Razorpay developer account, from there you will get the api key and secret key require for the integration.

Razorpay Payment Gateway Integration in Laravel 8 Tutorial

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

Step 1: Install Laravel

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

Step 2: Create Razorpay Account

In this step you need to create account on razorpay website and get account key id and secret. Then you need to add on .env file as following:

Step 3: Install razorpay/razorpay Package

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

Step 4: Create 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 Controller

Now, lets create a controller for Razorpay Payments. Create a controller named RazorpayPaymentController and put the following code in it:

app/Http/Controllers/RazorpayPaymentController.php

Step 6: Create Blade File

In this step, we will create view/blade file to accept razorpay payment. Lets create a blad filerazorpayView.blade.php” in “resources/views/” directory and put the following code in it respectively.

resources/views/razorpayView.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 –

Laravel 8 Two Factor Authentication with SMS

In this Laravel 8 Two Factor Authentication with SMS tutorial I will show you how to implement Two Factor Authentication with SMS in laravel 8. In this tutorial you will learn to authenticate user using SMS Two Factor Authentication in laravel. In this article I will share example to implement two factor authentication in laravel application. We will be using twilio api to send sms for two factor authentication. In two factor authentication using sms we will be sending sms to validate user account in laravel.

Laravel 8 Two Factor Authentication with SMS

In this step by step two factor authentication tutorial I will demonstrate you with example on how to add sms two factor authentication in laravel. Please follow the instruction given below:

Step 1 : Install Laravel

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

Step 2: Install Twilio Configuration

First of all you need to create account on twilio.com and add phone number. Then you will be provided account SID, Token and Number. Now, you need to add account SID, Token and Number in .env file:

.env

Now you need to install twilio/sdk composer package to use twilio api. Use the following command to install twilio/sdk.

Step 3: Create Migration for table

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

Once above command is executed there will be a migration file created inside database/migrations/ directory, just open migration file and update the function up() method as following:

Now, run the migration to create database table using following artisan command:

Step 4: Create and Update Models

Next we will create a model file.

app/Models/User.php

app/Models/UserCode.php

Step 5: Create Auth Scaffold

Use the following command to generate laravel auth scaffolding:

Lets create auth scaffold:

Step 6: Create Middleware

Now we will create a custom middleware to implement two factor authentication.

app/Http/Middleware/Check2FA.php

app/Http/Kernel.php

Step 7: Create 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 8: Create and Update Controllers

Now, lets open RegisterController and LoginController and put the following code in it:

app/Http/Controllers/Auth/RegisterController.php

app/Http/Controllers/Auth/LoginController.php

Let’s create TwoFAController controller and put the following code in it.

app/Http/Controllers/TwoFAController.php

Step 9: Create and Update Blade File

Finally we will update default register blade file and create new 2fa blade file as following:

resources/views/auth/register.blade.php

resources/views/2fa.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 –

Laravel 8 Pagination Example with Bootstrap Tutorial

In this Laravel 8 Pagination Example with Bootstrap Tutorial, I will show you how to create and use pagination using bootstrap in laravel application. In this tutorial you will learn to implement and use laravel in-built bootstrap pagination to display data. In this article I will share example how to use laravel inbuilt pagination with bootstrap table. This tutorial will demonstrate you how to use laravel pagination with tables and display data with pagination.

Laravel 8 Pagination Example with Bootstrap Tutorial

In this step by step tutorial I will guide you through how to implement bootstrap pagination in laravel application. Please follow the instruction given below:

  1. Install Laravel App
  2. Database Configuration
  3. Model and Migrations
  4. Generate Fake Data
  5. Create Controller & Route
  6. Use Pagination in Laravel
  7. Laravel Custom Pagination Parameter
  8. Convert Pagination Results To JSON
  9. Run Laravel Application

Install Laravel Project

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

switch to the project directory.

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.

Model and Migrations

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

Open database/migrations/timestamp_create_employees_table.php file and add the schema.

Now put the following code in the app/Models/Employee.php file to register the schema in the $fillable array.

Now, run the migration to create database table using following artisan command:

Generate Fake Data using Faker

Open the database/seeds/DatabaseSeeder.php file and place the following code.

Execute the given command to generate the data.

Create Controller & Route

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

Place the following code in app/Http/EmployeeController.php file.

app/Http/EmployeeController.php

Create 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

Render Records in View

In this step we will create a blade view file resources/views/home.blade.php and place the following code inside of it to render the employee records in Laravel view using Bootstrap Table component.

Use Pagination in Laravel

Now, we will add the laravel paginate function in the getData() function inside the EmployeeController class. We will use paginate() instead all() and pass number as an argument, that number defines the number of records to be shown to the user.

Now, we need to add the following code in the home.blade.php file below the table component.

Here is the final home.blade.php file.

home.blade.php

Laravel Custom Pagination Parameter

In this step we will add pagination links/url along with results. It will actually appends ?page=2.

Here, you also need to import and define useBootstrap() inside the boot function within the app/Providers/AppServiceProvider.php:

Convert Pagination Results To JSON

The Laravel paginator result classes implement the Illuminate\Contracts\Support\Jsonable Interface contract and expose the toJson method. This will transform your pagination results into JSON. Open routes/web.php file and place the following route with paginate function.

You can get the pagination JSON data on URL:


Run Laravel Application

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 Create Contact Form In Laravel 8 Example Tutorial

In this How to Create Contact Form In Laravel 8 Example Tutorial I’ll show you how to create simple contact form with validation in laravel 8. In this tutorial you will learn to create contact form with validation and send mail in laravel 8. In this article I will also show you how to submit and validate contact form data before submit in laravel. We will also send an email when contact form is submitted then save contact form input in the database. In this example I will guide you through creating contact form in laravel, validating contact form, submitting contact form and then sending email when contact form is submitted.

How to Create Contact Form In Laravel 8 Example Tutorial

In this step by step tutorial I will demonstrate you how to create simple contact form with validation and send email in laravel. Please follow the instruction given below:

  1. Install Laravel Project
  2. Make Database Connection
  3. Model and Migrations
  4. Create Controller
  5. Configure Contact Form Routes
  6. Add Custom CSS in Laravel
  7. Create Laravel Contact Form with Bootstrap
  8. Laravel Contact Form Validation
  9. Set Up Email Template
  10. Set Up Laravel Email Server
  11. Send Email in Laravel

Install Laravel Project

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

switch into the project directory:

Make Database Connection

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.

Create Model and Run Database Migrations

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

Open database/migrations/timestamp_create_contacts_table.php file and add the values for contact us form that we stored in the MySQL database.

Next, open app/Models/Contact.php file and add the $fillable property in the model as following.

Now, run the migration to create database table using following artisan command:

Create Contact Form Controller

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

Open app/Http/Controller/ContactUsFormController.php file and add the following code in it.

Configure Contact Form Routes in Laravel

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

Add Custom CSS in Laravel

Lets create /css/style.css file in public folder and put the below CSS code in the newly created CSS file.

Now, you can easily call this CSS file in the Laravel blade template, we need to paste the following code in the view/contact.blade.php file to add the custom CSS in Laravel.

Create Laravel 8 Contact Form with Bootstrap

Go to resources/views/ folder and create contact.blade.php blade view file inside of it. Then, put the following code in it.

Laravel Contact Form Validation

Now we will add validation on contact form input field using $errors->has() method.

Set Up Laravel Email Template

Create resources/views/mail.blade.php file and add the given below code in it.

Configure Laravel Email Server with Mailtrap

Sending Email in Laravel

Now use the following command to create a new Mailable class with contact.php file inside the app/Mails/ directory.

Now, go to Http/Controllers/ContactUsFormController.php file and put the following code with the given below code.

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 Create and Validate Form in Laravel 8

In this How To Create and Validate Form in Laravel 8 Tutorial I’ll show you how to submit form and validate form data in laravel 8 application. In this laravel form validation tutorial you will learn to submit and validate form data in laravel with built in laravel form validation available in laravel. In this Laravel 8 form validation tutorial I’ll share various validation implementation and use case to validate and display error messages in blade view file. In this laravel form validation tutorial we will be learning about laravel server side validations. In this tutorial, I’ll show you how to submit and validate form data and to display validation errors.

How To Create and Validate Form in Laravel 8

In this step by step tutorial I’ll demonstrate you how perform server side form validations in laravel form. We will also create example to submit and validate form data in laravel 8. Please follow the instruction given below:

  1. Install Laravel Project
  2. Make Database Connection
  3. Model and Database Migrations
  4. Create Form Validation Controller
  5. Register New Routes
  6. Implement Form Validation
  7. Add Custom CSS
  8. Start Laravel Application

Install Laravel Project

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

switch to the project directory.

Make Database Connection

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.

Model and Database Migrations

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


Open database/migrations/timestamp_create_forms_table.php file and add the form values that we need to store in the database.

Now open app/Form.php and add migration values such as ‘name’, ’email’, ‘phone’, ‘subject’, and ‘message’ in model file using $fillable array.

Now, run the migration to create database table using following artisan command:

Create Form Validation Controller

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

Place the following code inside the app/Http/Controller/FormValidtionController.php file.

Define Form Routes in Laravel

Open routes/web.php file and create the two routes.

Implement Form Validation in Laravel

Go to resources/views/ folder and create a form.blade.php file, then, update the following code in resources/views/form.blade.php file.

resources/views/form.blade.php

Add Custom CSS

In this step, we will add custom CSS in the Laravel project. Create /css/style.css file in public folder and add the following CSS code in the file.

Start Laravel Application

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 Properly Install and Use Bootstrap 4 in Laravel 8

In this How to Properly Install and Use Bootstrap 4 in Laravel 8 tutorial I will show you how to install bootstrap 4 in laravel 8. In this tutorial you will learn to install bootstrap 4 in laravel 8. In this article I will share example to install bootstrap 4 in laravel application.

How to Properly Install and Use Bootstrap 4 in Laravel 8

In this step by step laravel 8 install bootstrap 4 tutorial I will demonstrate you to install bootstrap 4 in laravel 8. We will cover the following concepts of Laravel and Bootstrap:

  • How to Install Laravel/UI.
  • How to install Bootstrap and its packages
  • How to compile Bootstrap assets.
  • How to install Bootstrap Auth Scaffolding.
  • How to use complied Bootstrap CSS and JS in Laravel blade template

Laravel Bootstrap 4

Bootstrap is a CSS framework that provides user-friendly UI components to build a next-level web or mobile application.

Install Laravel Project

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

Switch to the newly created project directory.

Install Laravel/UI

Now, switch the laravel project directory and run the following composer command to install laravel/ui package.

Install Bootstrap in Laravel 8

Run following artisan command to install Bootstrap in your Laravel project.

Install Bootstrap Auth Scaffolding

Use the following artisan command to Install the auth scaffoldings with Bootstrap.

We have successfully installed the bootstrap, and you can make sure by going to resource/js/bootstrap.js. You will see that popper.js and jQuery have been added to the bootstrap’s JavaScript file.

Install Bootstrap Packages

Now, we need to make sure we have Node installed on your local development system. Run the following command to check node installation.

Now, you need to install the bootstrap package and the related frontend dependencies such as jquery from npm using the following command:

Compile Assets

Check resources/sass folder _variables.scss and app.scss files have added along with sass variables and fonts.

Now, run the below command for asset compilation.


The above command compiles CSS and JavaScript files from resources/js and resources/sass folder to the public folder.

Automate SASS and JS Changes

Using Bootstrap in Laravel Blade Template

Now, you can use the bootstrap js and CSS in laravel blade template as following:

How to Install React JS in Laravel 8 with Bootstrap

In this How to Install React JS in Laravel 8 with Bootstrap tutorial I will show you how to install react js with bootstrap in laravel 8 application. In this tutorial you will learn to install react js with bootstrap in laravel. We will implement a laravel 8 react example application. In this tutorial we will understand how to install and setup laravel 8 with react js. In this example we will also install react with laravel and also laravel 8 react auth using laravel ui.

How to Install React JS in Laravel 8 with Bootstrap

In this step by step tutorial I will guide you through how to install react js with bootstrap in laravel application. Please follow the instruction given below:

Install Laravel Project

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

Switch to the Laravel project directory:

Install laravel/ui

Install Laravel UI package for starting with Laravel 8 with React JS. So if you want to start with Laravel 8 with React, run the below command:

Install React in Laravel

Use the following command to install react in laravel.

Install Required Packages

You can check the Node and NPM installation using the below command.


The following command install all the javascript packages which are required for our project.


The above command creates a node_modules folder and automatically installed all the packages that are registered in the package.json file.

Set Up React Component in Laravel

Now, we will create a React component inside the resource/js/User.js and paste the following code in it.

We have to register the React component inside the resources/js/app.js file.

Place the given below code inside the views/welcome.blade.php template.

Finally, we have to run the command to compile the JavaScript and CSS files for Laravel and React.js project.

Your code has been complied, 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 User Login Signup API with JWT Authentication

In this Laravel 8 User Login Signup API with JWT Authentication Tutorial I’ll show you how to build the user login and signup rest APIs with jwt (JSON web token) authentication in laravel 8. In this tutorial you will learn to create login and signup api using jwt authentication in laravel 8. In this example I’ll also show you how to install jwt auth and configure jwt auth in laravel 8. In this article, we will learn to create fully functional restful API with JWT Authentication in Laravel 8.

Laravel 8 User Login Signup API with JWT Authentication

In this step by step tutorial I will demonstrate you with example to create registration and login api with jwt authentication in laravel. Please follow the instruction given below:

  1. Install Laravel Application
  2. Database Connection
  3. Add User into MySQL Database
  4. Install & Configure JWT Authentication Package
  5. Set Up User Model
  6. Configure Auth Guard
  7. Build Authentication Controller
  8. Add Routes for Authentication
  9. Test REST API with Postman
  10. Conclusion

Install Laravel Application

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

Database Connection

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.

Add User into MySQL Database

Now, run following command to migrate database schema.

Install & Configure JWT Authentication Package

In this step, we will install tymon jwt auth package via the composer dependency manager. Use the following command to install laravel jwt authentication package.

After Installing tymon/jwt-auth package, we need to add service provider and alias in config/app.php file as following. Include the JWTAuth and JWTFactory facades inside the aliases array as following:

config/app.php

After that, run the below given command to publish the configuration file in Laravel for jwt auth:

Now, you need to generate jwt encryption keys. Use the following command to generate encryption keys needed to generate secure access tokens:


You can check this key inside the .env file.

Set Up User Model

Now you need to define Tymon\JWTAuth\Contracts\JWTSubject contract in User model. Open the app/Models/User.php file and put the following code in it.

Configure Auth guard

Place the following code in config/auth.php file.

Build Authentication Controller

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

Place the following code inside the app/Http/Controllers/AuthController.php file.

app/Http/Controllers/AuthController.php

Add Authentication Routes

We need to define the REST API authentication routes for auth process in Laravel JWT Authentication application. We need to add authentication routes in routes/api.php.

routes/api.php

Test Laravel JWT Authentication API with Postman

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

Authentication APIs for Login, Register, User Profile, Token Refresh and Logout.

Laravel 8 Angular Token Based Authentication with JWT

In this Laravel 8 Angular Token Based Authentication with JWT Tutorial I’ll show you how to create REST API with secure jwt token based authentication in Laravel 8 Angular application using JWT (JSON Web Token) . In this tutorial you will learn to create laravel rest api with token based authentication in laravel angular application. In this article, we will learn to create fully functional restful API with JWT Authentication in Laravel 8 angular application. We will also learn to create login and registration api using jwt authentication in laravel 8. In this example I will guide you through how to create fully functional restful API with JWT Authentication in Laravel 8 for laravel and angular application.

In laravel token based authentication provides secure user authentication system. Token based authentication restrain unauthenticated user from accessing the application. In this example we will be using JWT (JSON Web Token) token based authentication integrated with laravel application. In this example I’ll also show you how to install jwt auth and configure jwt auth in laravel 8.

Laravel 8 Angular Token Based Authentication with JWT

  1. Clone Laravel JWT Auth Repo
  2. Install and Configure Angular
  3. Create CORS Middleware
  4. Consume Angular Service
  5. Set JWT Token with Http Interceptor
  6. Angular User Registration Component
  7. Angular User Login Component
  8. Angular User Profile Component
  9. Angular User Lgout Component

Laravel and Angular Project Structure

Create new project directory using following command:

and this folder will have backend (Laravel API) and frontend (Angular) folders inside it.

Create Laravel JWT Authentication REST API

In this step we will clone the Laravel JWT Auth REST API project, switch to backend folder inside your project folder using following command:

Now we will download the project from GitHub repo link, then unzip all the files inside the backend folder:

Now, run the following commands to install required dependencies for node and composer for your laravel auth project:


Start the project using following command:

Now project will be started at

Use above link as base URL for accessing following api

Method Endpoint
POST /api/auth/register
POST /api/auth/login
GET /api/auth/user-profile
POST /api/auth/refresh
POST /api/auth/logout

Install and Configure Angular

In this step you need to switch into the frontend folder and install Angular application using following command:

Next, we will create following angular components for user authentication system.


Now we will be installing bootstrap framework to design authentication forms.


Open angular.json file and define the bootstrap CSS path as following:

We are ready to start angular app, run the following command to start angular application:

Adding up HttpClient

Lets import Http client module inside the app.module.ts file. The Http client module will handle the HTTP requests,

Insert Reactive Form Service

As we will be using ReactiveFormsModule and FormsModule. Lets Import and inject both the APIs in app.module.ts file.

Create CORS Middleware

In this step we will create a CORS middleware, this will enable us to share resources between two different domain/ports. Our backend is running on PORT:8000 and frontend running on PORT:4200. Switch to “backend” folder and run the following command:

Open app/Http/Middleware/CORS.php file and set the Acess-Control-Allow-Origin headers as following.

Open app/Http/Kernel.php file and add the define the “guest” CORS middleware inside the $routeMiddleware array.

Now, restart the backend application using following commnad:

Consume Laravel REST API with Angular Service

In this step we will generate a Angular service file using following command:

Now, open shared/auth.service.ts file and put the following code in it.

Now we will be create a angular service to validate & configure laravel JWT Token in Angular application. Run the following command to generate service file:

Lets open shared/token.service.ts file and put the following code in it.

Create Authentication State to Multiple Components

Now we will create auth state that can be accessed in components. Use the following command to create auth state:


Open shared/auth-state.service.ts file and put the following code in it.

Set Token in Header with HttpInterceptor

In this step we will set auth token in Header using HttpInterceptor class. Lets create  shared/auth.interceptor.ts inside the frontend folder and place the following code in it.

Put the following code in the app.module.ts file.

Angular User Registration Component

In this step we will setup angular register component, this will register a user using Laravel signup REST API in angular application. Lets open signup.component.ts file and put the following code in it.

Open signup.component.html file and insert the following code.

Angular User Login Component

In this step we will setup angular user login component, this will login user securly consuming Laravel login REST API in angular application. Lets open signin.component.ts file and put the following code in it.

Open signin.component.html file and include the given below code.

Angular User Profile Component

In this step we will setup angular user profile component, this will display user profile consuming Laravel user profile REST API in angular application. Lets open user-profile.component.ts file and put the following code in it.

Open user-profile.component.html file and incorporate the following code within.

Angular User Logout Component

In this step we will setup angular user logout functionality component, this will logout user consuming Laravel user logout REST API in angular application.

In this step you will create user logout functionality consuming Laravel user logout REST API in angular application. Lets open app.component.ts file and put the following code in it.

Open app.component.html file and insert the following code.

Start The Laravel App

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

Start The Angular App

Open another terminal,switch into frontend directory and start the angular development server using following command –

Laravel 8 Ajax Example Tutorial

In this Laravel 8 Ajax Example tutorial I will show you how to use ajax in laravel 8 applications. In this tutorial you will learn to use ajax in laravel 8. In this article I will demonstrate you how to retrieve data from database using ajax in laravel. With ajax you can get data from database without reloading or refreshing page in laravel 8. In this step by step guide you will understand laravel ajax request implementation.

Laravel 8 Ajax Example Tutorial

In this step by step tutorial I will demonstrate you with example how to get data from database using ajax in laravel 8 application. Please follow instruction given below:

  1. Install Laravel Project
  2. Make Database Connection
  3. Model and Migration
  4. Create Controller
  5. Create Routes
  6. Create Layout
  7. Make Ajax Request
  8. Define AJAX Logic
  9. Test Laravel AJAX App

Install Laravel Project

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

now, switch into the project directory using following command

Make Database Connection

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.

Create & Configure Model and Migration

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

Add Values in Model

Open app/Models/Todo.php and put the following code in it.

Configure and Run Migration

open xxxx_xx_xx_xxxxxx_create_todos_table.php migration file and update the function up() method as following:

Run Migration

Now, run the migration to create database table using following artisan command:

Create Controller

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

Paste the following code in the newly created controller in app/Http/Controllers/CrudController.php file.

app/Http/Controllers/CrudController.php

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

Create Layout

In this step we will create blade file to show you how to use AJAX in the Laravel application. Got to resources/views folder and create home.blade.php file. After creating home.blade.php file, we will create views/layouts/app.blade.php file. Now add the following code in the app.blade.php file.

Make Ajax request in Laravel

Put the following code in views/home.blade.php file.

AJAX Logic in Laravel

Now, we will create a todo.js file inside the public/js folder. Put the following code in it.

Test Laravel AJAX App

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 Yajra Datatables in Laravel 8

In this How to Use Yajra Datatables in Laravel 8 tutorial, I’ll show you how to install and use yajra DataTables in your laravel 8 application with example. In this tutorial you will learn to install and use yajra DataTables in your laravel 8 application. In this example, we will be using yajra datatable package for listing of records with pagination, sorting and filter (search) feature. Laravel Yajra datatables package comes with many built-in features for searching and sorting functionality.

How to Use Yajra Datatables in Laravel 8

In this step by step tutorial I’ll guide you through the process to install and use yajra DataTables in your laravel application. In this tutorial I will demonstrate you with example installation and use of DataTables in laravel. Please follow the instruction given below:

  1. Install Laravel App
  2. Install Yajra Datatables
  3. Set Up Model and Migrations
  4. Insert Dummy Data
  5. Create Controller
  6. Define Route
  7. Create View

Install Laravel App

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

Switch into the project project directory using following command

Install Yajra Datatable Package

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

Run vendor publish command further this step is optional:

Set Up Model and Migrations

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

Open database/migrations/timestamp_create_students_table.php file and add the given below code.

Next, go to app/Models/Student.php file and add the $fillable property in the Student model as following.

Now, run the migration to create database table using following artisan command:

Insert Dummy Data or Records

Open the database/seeds/DatabaseSeeder.php file and add the following code.

Run the following command to generate dummy data:

Create DataTable Controller

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

Open app/Http/Controllers/StudentController.php file and add the following code.

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

Display Data with Yajra Datatables

Open resources/views/welcome.blade.php file and put the following code.

resources/views/welcome.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 –

How to Install and Use Summernote Editor in Laravel 8

In this How to Install and Use Summernote Editor in Laravel 8 Tutorial I’ll show you how to install and use Summernote editor in laravel 8. In this tutorial you will learn to install and use Summernote editor in laravel 8. In this example I will show you how to directly use Summernote editor without and laravel package in laravel blade view file. We will not going to install and laravel package to install and use Summernote editor. We will directly integrate Summernote editor using summernote javascript libraries and css files.

How to Install and Use Summernote Editor in Laravel 8

In this step by step tutorial I will demonstrate you how to install and use summernote editor in laravel 8 application without any summernote package. Please follow the instruction given below:

  1. Install Laravel Project
  2. Install Summernote Editor
  3. Display Summernote Editor

Install Laravel Project

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

Use the following command to switch into the project directory.

Install Summernote Editor in Laravel

Now, we will use the following javascript libraries and css files

Display Summernote Editor in Laravel 8

Now put the following code in views/home.blade.php blade view file.

views/home.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 view the Summernote Editor integration example