Sunday, 19 January 2020

How to Create AutoComplete Textbox using PHP with jQuery Ajax



Do you know what is AutoSuggest or AutoComplete textbox? The AutoSuggest Textbox means when user has type in search textbox, then they can get quickly get result according what they has type in search box, and they can select value form pre populated search suggestion from the list. This AutoSuggestion feature will load suggestion automatically, when user has type some character into Search textbox field. Here we will make lightweight AutoSuggest or AutoComplete textbox by using PHP script with Mysql Database, jQuery and Ajax.

Now in your mind one question will arise, How it called light weight AutoSuggest Textbox. This is because here when user has type in search textbox, then it will only one time fetch data from Mysql database, and then after by using jQuery plugin it will filter data from data which has fetch from database and display filter result in AutoSuggest search result. So, Here we have called this light weight AutoSuggest or AutoComplete Textbox, because it is only send one request to Mysql database and fetch data and by using jQuery plugin it has filter result from that data and display as AutoSuggest result below Search box.

In Most of AutoComplete or AutoSuggest tutorial, we have seen on every character type, it has send request to Mysql database using Ajax and display search result, but In this tutorial, it will only send one Ajax request to Mysql database and then after data will be filter by using jQuery and display one web page. For make this tutorial, here we have use jQuery "JsLocalSearch" plugin, which is very light weight and fast jquery plugin, which used for filter records from client side data and which is mainly used for filter and search a of element which we have provide. It main feature is to search html content which we have provide. Below you can find source code of How to make AutoSuggest Textbox with Bootstrap library by using PHP script with jQuery Ajax and Mysql database.







Database



--
-- Database: `testing`
--

-- --------------------------------------------------------

--
-- Table structure for table `customer_table`
--

CREATE TABLE `customer_table` (
  `customer_id` int(11) NOT NULL,
  `customer_first_name` varchar(200) NOT NULL,
  `customer_last_name` varchar(200) NOT NULL,
  `customer_email` varchar(300) NOT NULL,
  `customer_gender` varchar(30) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `customer_table`
--
ALTER TABLE `customer_table`
  ADD PRIMARY KEY (`customer_id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `customer_table`
--
ALTER TABLE `customer_table`
  MODIFY `customer_id` int(11) NOT NULL AUTO_INCREMENT;





index.php



<!DOCTYPE html>
<html>
 <head>
  <title>jQuery Auto Suggest Textbox with Bootstrap 4 using PHP Ajax</title>
  <script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
  <script src="JsLocalSearch.js"></script>
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" />
  <style> 
  .mark {
    background-color: #d7ffe7 !important
  }

  .mark .gsearch{
    font-size: 20px
  }

  .unmark {
    background-color: #e8e8e8 !important
  }

  .unmark .gsearch{
    font-size: 10px
  }
  
  .marktext
  {
   font-weight:bold;
   background-color: antiquewhite;
  }
  </style>
 </head>
 <body>
  <br />
  <br />
  <div class="container">
   <h3 align="center">jQuery Auto Suggest Textbox with Bootstrap 4 using PHP Ajax</h3>
   <br />
   <br />
   <div class="row">
    <div class="col-md-3"></div>
    <div class="col-md-6">
     <input type="text" id="gsearchsimple" class="form-control input-lg" placeholder="Search..." />

     <ul class="list-group">

     </ul>
     <div id="localSearchSimple"></div>
     <div id="detail" style="margin-top:16px;"></div>
    </div>
    <div class="col-md-3"></div>
   </div>
  </div>
 </body>
</html>
<script>
$(document).ready(function(){
 $('#gsearchsimple').keyup(function(){
  var query = $('#gsearchsimple').val();
  $('#detail').html('');
  $('.list-group').css('display', 'block');
  if(query.length == 2)
  {
   $.ajax({
    url:"fetch.php",
    method:"POST",
    data:{query:query},
    success:function(data)
    {
     $('.list-group').html(data);
    }
   })
  }
  if(query.length == 0)
  {
   $('.list-group').css('display', 'none');
  }
 });

 $('#localSearchSimple').jsLocalSearch({
  action:"Show",
  html_search:true,
  mark_text:"marktext"
 });

 $(document).on('click', '.gsearch', function(){
  var email = $(this).text();
  $('#gsearchsimple').val(email);
  $('.list-group').css('display', 'none');
  $.ajax({
   url:"fetch.php",
   method:"POST",
   data:{email:email},
   success:function(data)
   {
    $('#detail').html(data);
   }
  })
 });
});
</script>


fetch.php



<?php

//fetch.php;

$connect = new PDO("mysql:host=localhost; dbname=testing", "root", "");

if(isset($_POST['query']))
{
 $query = "
 SELECT DISTINCT customer_email FROM customer_table 
 WHERE customer_email LIKE '%".trim($_POST["query"])."%'
 ";

 $statement = $connect->prepare($query);

 $statement->execute();

 $result = $statement->fetchAll();

 $output = '';

 foreach($result as $row)
 {
  $output .= '
  <li class="list-group-item contsearch">
   <a href="javascript:void(0)" class="gsearch" style="color:#333;text-decoration:none;">'.$row["customer_email"].'</a>
  </li>
  ';
 }

 echo $output;
}

if(isset($_POST['email']))
{
 $query = "
 SELECT * FROM customer_table 
 WHERE customer_email = '".trim($_POST["email"])."' 
 LIMIT 1
 ";

 $statement = $connect->prepare($query);

 $statement->execute();

 $result = $statement->fetchAll();

 $output = '
 <table class="table table-bordered table-striped">
  <tr>
   <th>First Name</th>
   <th>Last Name</th>
   <th>Email</th>
   <th>Gender</th>
  </tr>
 ';

 foreach($result as $row)
 {
  $output .= '
  <tr>
   <td>'.$row["customer_first_name"].'</td>
   <td>'.$row["customer_last_name"].'</td>
   <td>'.$row["customer_email"].'</td>
   <td>'.$row["customer_gender"].'</td>
  </tr>
  ';
 }
 $output .= '</table>';

 echo $output;
}

?>


So, If you have follow above source code, then you can learn How to Create Light Weight dynamic AutoSuggest or AutoComplete Textbox by using PHP script with Mysql database, jQuery and Ajax. If you want to get this tutorial source code file in zip folder, you can email us at webslesson@gmail.com.

Sunday, 12 January 2020

Laravel 6 - Crop & Upload Image using jQuery with Ajax



Are you a learner of Laravel framework for web application development, So here in this post, you can find interesting topic like How to Crop an Image before uploading in Laravel framework. Here we have use Laravel 6 framework for make this type of feature in any web based application. If you want to learn How to Crop and Upload image in Laravel 6 framework by using jQuery with Ajax, so this post will help you to learn this topic.

Here we have use jQuery Croppie plugin used for Crop an Image before upload it. There are many jQuery plugin are available on internet for Crop image, but here we have use Croppie plugin with Laravel 6 framework for Crop image. Because it is widely used for Crop image, and it is easy to learn How to crop image. So, If you want to add feature like image crop for your web application, so you can use this plugin, because it is very easy to integrate in our web application.

In short, In this post we have use jQuery plugin for Crop an Image and by using Ajax we have upload on web server with Laravel 6 framework. Now in your mind how this Croppie plugin has work. So when page has been load into web browser, then this Croppie plugin has been initialize and once we have select image from our local computer then that selected image preview, we can see on web page. In that preview we can also zoom image, and we can drag the view port of the crop area also. So, this tutorial, you can find step by step process for How to Crop image by using Croppie plugin, and then after how to use Ajax for upload cropped image with Laravel 6 framework.

  • Download and Install Laravel 6 Framework
  • Create Controller Class
  • Create View Blade File
  • Set Route
  • Run Laravel 6 Application


Download and Install Laravel 6 Framework


If you want to use Laravel framework for you any web development task, so first you have to download and installed it in you local computer. For download Laravel 6 framework you have to go command prompt and go to directory in which you want to download Laravel framework, and after this you have to run following command in command prompt.


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


This command will make laravel6 folder and under this it will download Laravel 6 framework.




Create Controller Class


After download Laravel framework, so you are ready to use Laravel for web development. Here first we want to make Controller class for handle browser http request.So, for create Controller class we have to go command prompt and run following command

//Code
This command will make ImageCropController.php file in app/Http/Controllers folder. In this class we have make following method.

index() - This is the root method of this ImageCropController.php controller class. This method has load view file in browser.

upload() - This method has recieved Ajax request for upload Crop image. This method has received in image in binary string. By using base64_decode() method it will convert binary string to image format and by using file_put_contents() function image will be uploaded in crop_image folder. And lastly send response to Ajax request in Ajax format.

app/Http/Controllers/ImageCropController.php

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class ImageCropController extends Controller
{
    function index()
    {
     return view('image_crop');
    }

    function upload(Request $request)
    {
     if($request->ajax())
     {
      $image_data = $request->image;
      $image_array_1 = explode(";", $image_data);
      $image_array_2 = explode(",", $image_array_1[1]);
      $data = base64_decode($image_array_2[1]);
      $image_name = time() . '.png';
      $upload_path = public_path('crop_image/' . $image_name);
      file_put_contents($upload_path, $data);
      return response()->json(['path' => '/crop_image/' . $image_name]);
     }
    }
}



Create View Blade File


In Laravel framework, View Blade file has been used for display HTML output on web page. View file has been store under resources/views folder. Here we have make image_crop.blade.php file for this tutorial. In this file we have use Croppie plugin, Bootstrap library and jquery library.

resources/views/image_crop.blade.php

<html>
 <head>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>How to Crop And Upload Image in Laravel 6 using jQuery Ajax</title>
  <script src="{{ asset('js/jquery.min.js') }}"></script>
  <link rel="stylesheet" href="{{ asset('css/bootstrap.min.css') }}" />
    <link rel="stylesheet" href="{{ asset('css/croppie.min.css') }}" />
  <!--<script src="{{ asset('js/bootstrap.min.js') }}"></script>!-->
    <script src="{{ asset('js/croppie.min.js') }}"></script>
 </head>
 <body>
  <div class="container">    
    <br />
        <h3 align="center">How to Crop And Upload Image in Laravel 6 using jQuery Ajax</h3>
      <br />
      <div class="card">
        <div class="card-header">Crop and Upload Image</div>
        <div class="card-body">
          <div class="form-group">
            @csrf
            <div class="row">
              <div class="col-md-4" style="border-right:1px solid #ddd;">
                <div id="image-preview"></div>
              </div>
              <div class="col-md-4" style="padding:75px; border-right:1px solid #ddd;">
                <p><label>Select Image</label></p>
                <input type="file" name="upload_image" id="upload_image" />
                <br />
                <br />
                <button class="btn btn-success crop_image">Crop & Upload Image</button>
              </div>
              <div class="col-md-4" style="padding:75px;background-color: #333">
                <div id="uploaded_image" align="center"></div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <br />
          <br />
          
          <br />
          <br />
    </div>
 </body>
</html>

<script>  
$(document).ready(function(){
  
  $image_crop = $('#image-preview').croppie({
    enableExif:true,
    viewport:{
      width:200,
      height:200,
      type:'circle'
    },
    boundary:{
      width:300,
      height:300
    }
  });

  $('#upload_image').change(function(){
    var reader = new FileReader();

    reader.onload = function(event){
      $image_crop.croppie('bind', {
        url:event.target.result
      }).then(function(){
        console.log('jQuery bind complete');
      });
    }
    reader.readAsDataURL(this.files[0]);
  });

  $('.crop_image').click(function(event){
    $image_crop.croppie('result', {
      type:'canvas',
      size:'viewport'
    }).then(function(response){
      var _token = $('input[name=_token]').val();
      $.ajax({
        url:'{{ route("image_crop.upload") }}',
        type:'post',
        data:{"image":response, _token:_token},
        dataType:"json",
        success:function(data)
        {
          var crop_image = '<img src="'+data.path+'" />';
          $('#uploaded_image').html(crop_image);
        }
      });
    });
  });
  
});  
</script>


Set Route


In Laravel framework, we have to set the route of Controller class method. For this we have to open routes/web.php. In this file we have to set the route of this Controller class method.

routes/web.php

Route::get('image_crop','ImageCropController@index');

Route::post('image_crop/upload', 'ImageCropController@upload')->name('image_crop.upload');


Run Laravel Application


For Run Laravel web application, we have to go command prompt and write following command.


php artisan serve


This command will start Laravel server and give you Laravel application base url. For check above code, you to enter http://127.0.0.1:8000/image_crop url, then after you can check above code. So, this is complete step by step process of image preview for crop image using jQuery Croppie plugin before uploading of image by using Ajax in Laravel 6 framework. If you want to get complete source code file, you can free email us at webslesson@gmail.com. We will send you source code file in zip folder.


Monday, 6 January 2020

Laravel 6 - Store & Retrieve Images From Mysql Database



Storing of Images into Mysql Database and then after fetch images from Mysql database in Laravel framework is one task for any web developer. And in this post, we are going to learn how to store image and retrieve images from MySql database, we will learn this things in Laravel 6 framework. Because this is latest version of Laravel framework, and every learner want to learn any topic in latest version. So In Laravel 6 framework, how to insert images in Mysql database, and then after how to fetch images from Mysql database and display on web page.

In this post, we have step by step describe the process of insert images in Mysql table in Laravel 6 framework. Now in your mind one question has been arise, why we have to store images in database. This is because we can store images in folder, so why we have to store images in database and why we have increase the size of our database. But there is also some advantage of storing or inserting images into database also. There is one important advantage is that when we have take the back up of our database, then at the time all our images or file backup has been also take place and we do not want to take back up of images separately.

There is other benefits of store images in database is that all images has been store in binary form, and it will be visible on web page only. So, here our images has been secured because it is store in binary form not in it's original form. So there are many other benefits of storing images in database. Here in this post we have not discuss benefits of storing images in database, but here we want to discuss what is the process of store and retrieve images from Mysql database in Laravel 6 framework.



  1. Install Laravel 6 framework
  2. Make Database Connection
  3. Create Model Class
  4. Download Image Intervention Library
  5. Create Controller Class
  6. Create View Blade File
  7. Set Route
  8. Run Laravel Application

Install Laravel 6 framework


If you want to use Laravel for you web application development. For this first we want to download Laravel latest version. For this you have to go command prompt and go to directory in which you want to download and Install Laravel framework and run following command.


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


This command will make laravel6 folder and in that folder it will download latest version of Laravel framework.

Make Database Connection


For make database connection in Laravel 6 framework, we have to open .env file. In this file we have to define Mysql database configuration details, which you can find below.


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


Create Model Class


For store and retrieve image from Mysql database, here we will use Laravel Model class for database related operation. So, first we want to make Model class, for this we have to go command prompt and run following command.


php artisan make:model Images -m


This command will make Images.php model class in app directory and also make table migrations file in database/migrations folder. First we have to open migration file which you can find database/migrations folder and in that you to define table column defination which you can find below.


<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateImagesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('images', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('user_name');
            $table->binary('user_image');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('images');
    }
}



Here we have add two table column like user_name and user_image. Now we want to create table in mysql database. For this also we have to go command prompt and run following command.


php artisan migrate


This command will make images table in Mysql database. Now we open app/Images.php model class. In this class we have to define in which table column data, will be fill be user, we have to define in model class, which you can find below.


<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Images extends Model
{
    protected $fillable = ['user_name', 'user_image'];
}



Download Image Intervention Library


Here we have use Image Intervention library for Image manipulation. This library is open source PHP image library for handling and manipulation of Image, this library has also provide feature like create, edit and compose image. First we want to download this library, for this we have to run following command.


composer require intervention/image


This command will download this image intervention library, here we have use extra package in Laravel framework, so we have to tell laravel for this new package. For this we have to open config/app.php and define new package details.


'providers' => [

    // ...
      Intervention\Image\ImageServiceProvider::class,
    // ...
  ],
'aliases' => [
    // ...
      'Image'     => Intervention\Image\Facades\Image::class,
    // ...
  ],


So, this way we can use extra package in Laravel fraework.



Create Controller Class


In Laravel framework for handle http request, we have to create controller class. For create controller class file we have to go command prompt and run following command.


php artisan make:controller StoreImageController


This command will make StoreImageController.php controller file under app/Http/Controllers folder. In this controller class, first we have to import following class in header of this class.


use Illuminate\Support\Facades\Response;
use App\Images;
use Image;



After this in controller class we have make following method.

index() - This is the root method of this class, It will fetch data from images folder and display on store_image.blade.php file.

insert_image(Request $request) - When form has been submitted, then this method has received form data for insert data into Mysql database. In this method first it validate that data follow validation rules or not. If it follow validation rules then it has process for insert into mysql table. Here for before store image into Mysql database, first it has been converted into binary form and then after store into Mysql database.

fetch_image($image_id) - This method has first fetch single user data based on value of primary key, and from that data first it has fetch image and then after converted into binary and return image as an output of this method.


<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Images;
use Illuminate\Support\Facades\Response;
use Image;

class StoreImageController extends Controller
{
    function index()
    {
     $data = Images::latest()->paginate(5);
     return view('store_image', compact('data'))
       ->with('i', (request()->input('page', 1) - 1) * 5);
    }

    function insert_image(Request $request)
    {
     $request->validate([
      'user_name'  => 'required',
      'user_image' => 'required|image|max:2048'
     ]);

     $image_file = $request->user_image;

     $image = Image::make($image_file);

     Response::make($image->encode('jpeg'));

     $form_data = array(
      'user_name'  => $request->user_name,
      'user_image' => $image
     );

     Images::create($form_data);

     return redirect()->back()->with('success', 'Image store in database successfully');
    }

    function fetch_image($image_id)
    {
     $image = Images::findOrFail($image_id);

     $image_file = Image::make($image->user_image);

     $response = Response::make($image_file->encode('jpeg'));

     $response->header('Content-Type', 'image/jpeg');

     return $response;
    }
}



Create View Blade File


In Laravel framework for display html output on web page, here it has use blade file which has been store under resources/views folder. Here in this views file, we have done following things.
  • Write code for display form data validation error
  • Write code for display success message
  • Make HTML form for enter name and select profile image
  • Make HTML table for display dynamic data on web page

resources/views/store_image.blade.php

<html>
<head>
 <meta name="viewport" content="width=device-width, initial-scale=1">
 <title>Insert Image into Mysql Database in Laravel 6</title>
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
 <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />
 <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
</head>
<body>
 <div class="container">    
  <br />
  <h3 align="center">Insert Image into Mysql Database in Laravel 6</h3>
    <br />
    @if($errors->any())
    <div class="alert alert-danger">
           <ul>
           @foreach($errors->all() as $error)
            <li>{{ $error }}</li>
           @endforeach
           </ul>
        </div>
    @endif

    @if(session()->has('success'))
     <div class="alert alert-success">
     {{ session()->get('success') }}
     </div>
    @endif
    <br />

    <div class="panel panel-default">
         <div class="panel-heading">
             <h3 class="panel-title">User Form</h3>
         </div>
         <div class="panel-body">
         <br />
         <form method="post" action="{{ url('store_image/insert_image') }}"  enctype="multipart/form-data">
          @csrf
          <div class="form-group">
          <div class="row">
           <label class="col-md-4" align="right">Enter Name</label>
           <div class="col-md-8">
            <input type="text" name="user_name" class="form-control" />
           </div>
          </div>
         </div>
         <div class="form-group">
          <div class="row">
           <label class="col-md-4" align="right">Select Profile Image</label>
           <div class="col-md-8">
            <input type="file" name="user_image" />
           </div>
          </div>
         </div>
         <div class="form-group" align="center">
          <br />
          <br />
          <input type="submit" name="store_image" class="btn btn-primary" value="Save" />
         </div>
         </form>
      </div>
     </div>
     <div class="panel panel-default">
         <div class="panel-heading">
             <h3 class="panel-title">User Data</h3>
         </div>
         <div class="panel-body">
         <div class="table-responsive">
                <table class="table table-bordered table-striped">
                  <tr>
                     <th width="30%">Image</th>
                     <th width="70%">Name</th>
                  </tr>
                  @foreach($data as $row)
                  <tr>
                   <td>
                    <img src="store_image/fetch_image/{{ $row->id }}"  class="img-thumbnail" width="75" />
                   </td>
                   <td>{{ $row->user_name }}</td>
                  </tr>
                  @endforeach
              </table>
              {!! $data->links() !!}
             </div>
         </div>
     </div>
    </div>
 </body>
</html>



Set Route


Before run Laravel application, first we have to set the route of Laravel controller class method. For this we have to open routes/web.php file and set the route of controller method.


Route::get('store_image', 'StoreImageController@index');

Route::post('store_image/insert_image', 'StoreImageController@insert_image');

Route::get('store_image/fetch_image/{id}', 'StoreImageController@fetch_image');


Here we have set the route of all controller class method.

Run Laravel Application


If our code is ready, now we need to check in browser. For this we have to start laravel server, for this we have to go command prompt and run following command.


php artisan serve


This command will start Laravel server and give us base url of our Laravel application. For check above code we have to write following url in browser.


http://127.0.0.1:8000/store_image


So, this is complete step by step process for how to insert images into mysql database in Laravel 6 framework and how to fetch images from mysql table and display on web page in Laravel 6 application. If you want to get source code of this tutorial in zip, you can feel free to email us at webslesson@gmail.com, we will reply you with attach source code zip file.




Friday, 3 January 2020

How PHP Is Used in WordPress

WordPress is written in many languages, but PHP is one of the primary programming and scripting languages used. Just like WordPress, PHP is open-source, making it one of the easiest languages for building websites these days.

But how exactly does PHP work? Let’s say someone visits your WordPress travel blog website. Before they can see anything, your web server gets a request to serve up your homepage. This means your homepage link (also known as a URL) is asking for a PHP file.

Now that the server knows which PHP code to run, it will execute the proper PHP before it’s ready to be sent back to the web user. The PHP program responsible for your homepage generates the appropriate HTML and sends it to the web user. The raw HTML code generated by the PHP that’s sent is not what will be physically seen. The web user will only see the finished version of your travel blog homepage filled with fun stories and photos of your adventures.

There are many tools you can use to help create the best website. They can help you skip the code writing and jump right into making the perfect website. Check out these tools and free content management systems to help get you started.

What Areas of WordPress Use PHP?


WordPress files, different themes, additional plugins, and various functions are written in PHP. Let’s take a closer look at some of these areas.

Downloading WordPress


When someone starts using WordPress, they’ll meet PHP in that very first download. After going to WordPress.org and downloading the latest version, you can already see how PHP is used in WordPress. The contents of the WordPress ZIP file below shows that the core files are written in the PHP (notice the .php file extension).



Themes and Plugins


Also, when installing a theme on your WordPress website, you will see numerous files written in the PHP language. Let’s look at one of these popular themes – Astra. Below you can see a list of the downloaded files.




Additionally, just like themes, plugins are also mainly written in PHP.

Functions, Hooks, and Classes


Going a bit deeper, WordPress uses PHP for functions, hooks, and classes and it’s what makes WordPress so flexible. They are used to help you extend your WordPress functionality.



Functions


Each WordPress theme has a file named (appropriately enough) functions.php. This special file allows developers to define theme features and functions. The file acts as a WordPress plugin and is used to add your own custom code bits in your WordPress. However, unlike a plugin, it will only be recognized in the theme you’re currently using. Let’s look at some of the most well-known WordPress functions.

  • get_theme_mod() – retrieves theme modification value for the current theme.
  • add_setting() – adds a customized setting.
  • apply_filters() – calls the functions added to a filter hook.
  • get_comments_number() – retrieves the amount of comments a post has.
  • add_section() – adds a customized section.
  • is_home() – determines if the query is for the blog homepage.
  • get_sidebar() – loads sidebar template.
  • esc_attr() – escaping for HTML attributes.
  • get_option() – retrieves an option value based on an option name.

These are just a small snippet of the full list of WordPress functions.

Hooks


If you’ve ever modified, expanded, deleted or changed anything in WordPress, then it’s likely that you used a hook to do it. There are two types, the do-something or action hook and the customization or filter hook. When you want to add, delete or update functionality, you will use the action hook. For example, sending an email or adding instructions. When you want to change (i.e., filter) existing output, you will use the filter hook. For example, attaching links to a post or changing the style of a heading.

There are options you can choose from when you decide to modify your code. You can use the WordPress action hooks reference and filter hook reference to help guide you change the things you want.

Classes


A class is an object oriented-programming concept. Classes are useful for making PHP represent everyday objects that we understand (e.g. car, house or store). A good way to look at it is a class can help organize and group your functions, but a function can’t group your classes. For example, we can have a class called car. This car class can have a function called drive() and an attribute called current_speed. Interestingly enough, you don’t need to use functions inside your classes.

Do You Need to Know PHP to Use WordPress?


As a WordPress user, you do not need to learn PHP to build, run or manage a WordPress website. This is one reason WordPress is so user-friendly.

Most people can use WordPress without learning PHP or how to code. However, it’ll open new possibilities if you know PHP. If you know PHP, you will always have the option to change, develop or experiment with your WordPress site. More advanced developers can use PHP for more complicated customizations.

With some basic PHP skills, you can learn common and popular functions that might help make quick and easy, yet significant changes to your WordPress site. It is also possible to change themes and make plugins. Before you know it, you’ll be taking advantage of functions, variables, and strings then using them with WordPress’ hooks, actions, and filters.

Wrapping Up


WordPress is built with PHP. You’ll find PHP throughout its system. PHP is used to download WordPress, to tweak and add functions to your site or to add themes and plugins. PHP is one of the great elements in helping WordPress be the CMS that it is.

Best 10 Tips for Laravel Performance Optimization


Laravel is viewed as the best PHP system of 2017, which was discharged in 2011. On the off chance that you try to turn into a PHP developer, at that point you have caught wind of Laravel. It figures out how to be at the main structure throughout recent years. Other than the different solid highlights it offers, the most significant among developers and organizations are controlling the intensity of Laravel performance development.

There are two key factors to decide the success of every business application performance and development or you can hire a laravel developer. In this specific circumstance, guaranteeing the exhibition of Laravel application is a critical aptitude that each developer ought to have the option to convey to their customers. Much of the time, the administration information systems that give basic leadership backing to the executive’s layers should be quick and high performing consistently.

Tips for Laravel Performance Optimization


Limit the use of the plugin


Utilizing an excessive number of modules for various highlights and functionalities is one of those strong reasons that lead your site to have an exceptionally moderate speed. For your Laravel development, you can locate countless modules accessible. These plugins consists of a large number of libraries and documents that have more amount of time for loading. For improving the development with Laravel Performance Optimization, it is important to give the plugins that are a bit much in the undertaking.

Utilize Eager Loading


So as to complete CRUD (make, recover, update, erase) tasks in a simple way, Laravel utilizes Eloquent ERM. this provides the object models with the database tables for supporting it and dealing with the database collaboration. Presently, this can bring about the production of an enormous number of questions and hinders the exhibition. It is all the more simple and helpful to utilize anxious stacking approach. At the point when you prepare to manufacture questions for the enthusiastic stacking, you will ready to recover the article models which are related to any time of time.



Utilize the most recent version of PHP


At the point when you utilize the most recent form of PHP in your venture you will have the option to see upgrades in the undertaking as far as execution. So you should follow the latest version of PHP for the applications.

Use Packages Wisely


GitHub, just as other code facilitating administrations, offers various Laravel bundles to be utilized. You find a workable pace some extra usefulness to your Laravel site when you utilize such Laravel bundles. So your application will perform better when you utilize a controlled number of bundles in your application.

Configure Caching


It is possible to reserve all your design records in here. The structure will stack this order rapidly. You should utilize this order just during the hour of the project development. With the application development, the options of setup will be changing. And you should use this direction to run the project in local development.

Profile Queries


For Laravel development, we need to exhibit your application. For a similar explanation, it is significant you should keep an eye on various questions and perceive how they are functioning. When you realize that you can investigate the zones which should be streamlined. You can use the profiler packages like Debugar when these queries are observed and run on every page.

Utilizing JIT Compilers


It isn't feasible for the PCs to comprehend PHP in a local way. It is not possible that you run PHP by the machines to order to the bytecode. For a similar explanation, we utilize the Zend motor sort of broker for the work. Zend motor deciphers the PHP records you have and afterward likewise executes C schedules. Presently, this is an extremely moderate procedure. It means a record of PHP is controlled by the server, it also needs AST parser for changing into tokens and then decipher it. Regardless of whether it gets a similar outcome, at last, it needs to gather it every single time.

Static records use CDN


You need to improve the presentation of your Laravel application for loading static resources with the CDN server. If a client opens an application, the data is given to the client from the CDN. Along these lines, the page load speed will expand essentially and clients will have a superior encounter. So as to get this going, you should portray the static assets which are available on the said application.

Utilizing Artisan Commands


Craftsman direction is an exceptionally helpful apparatus that accompanies Laravel and it is utilized by engineers to improve the presentation of the site. Particularly for the situation where the Laravel engineer is attempting to think of countless design and courses, this can just end up being valuable. Along these lines the designer might be making reserve which is as a plain exhibit thus rather than Laravel stacking the genuine item, it will rapidly stack store.

If you neglect to do as such, at that point Laravel won't deal with the progressions that you have made as it has stacked them from the store. Additionally reserve the client information, areas, and settings as it can diminish the quantity of SQL inquiries. When the information transforms, you ought to discredit the reserve. You likewise need to have your Forge send content have directions just as reserve your courses, sees and configs.

Improve your Database


Improving the database in Laravel assist you with expelling any pointless brief records which are available in there. You can likewise get out the reserve and the old reinforcements which are spared in there. This will help the database and speed up and execute. This toolbar will show you SQL requests that are used by the given page and proportion of memory they are using.



Author Bio


Sunny Chawla is a Hiring Director at Alliance International – an IT Recruitment Agency. He specializes in hire best laravel programmers, staffing, HR services, and Careers advice service for overseas and international businesses.

Sunday, 29 December 2019

Importing Large CSV File into Multiple MySql Table using PHP



Currently, I have working on one my project, In which I want to import Large CSV file data into Two Mysql table. So, I have follow one by one insert data into multiple table. But when I have upload on server and try to import large data from CSV file but my script has been taken long time for import data from large csv file and get the error of timeout error on web page. So, I have come in trouble and try different way to import large data from CSV file by using PHP script but I have not get success.

So, I have start to search on internet and find solution of How to Import large CSV file into Multiple Mysql table. And on internet I have found "LOAD INFILE" Mysql command which will read data from CSV file and in one query execution it will insert data into Mysql table by using PHP script. But by using this command we can only import data from ine one table only and there is on internet I have not found any tutorial on How to import huge CSV file with 200000 rows of data into Multiple mysql table by using PHP script. So, I have try to write my own logic for solve the problem of importing large csv file data into multiple table by using PHP script.

In this tutorial, we have you can find the solution of importing of large csv file data into multiple mysql table by using PHP script. In this tutorial, we have use MYSQL LOAD DATA command, which will makes your task of importing large csv file into mysql table will do very easy and completed this task very fast. If you have working on any enterprise level application, and in that application you have to work with large data, then at the time CSV file has been used for take data from one application to another application. Because .CSV file is lighter than any other type of file extension, Mysql database has provide command for read csv file data and import into database in single query execution. So, Below you can find solution of importing large csv file data into multiple mysql table with PHP script.






Mysql Database


Run following SQL script, it will make customer table and order table in your local mysql database. In both table one table column like customer id is common.


--
-- Database: `testing`
--

-- --------------------------------------------------------

--
-- Table structure for table `customer_table`
--

CREATE TABLE `customer_table` (
  `customer_id` int(11) NOT NULL,
  `customer_first_name` varchar(200) NOT NULL,
  `customer_last_name` varchar(200) NOT NULL,
  `customer_email` varchar(300) NOT NULL,
  `customer_gender` varchar(30) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- --------------------------------------------------------

--
-- Table structure for table `order_table`
--

CREATE TABLE `order_table` (
  `order_id` int(11) NOT NULL,
  `customer_id` int(11) NOT NULL,
  `product_name` varchar(200) NOT NULL,
  `product_price` double(10,2) NOT NULL,
  `order_date` varchar(30) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `customer_table`
--
ALTER TABLE `customer_table`
  ADD PRIMARY KEY (`customer_id`);

--
-- Indexes for table `order_table`
--
ALTER TABLE `order_table`
  ADD PRIMARY KEY (`order_id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `customer_table`
--
ALTER TABLE `customer_table`
  MODIFY `customer_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;

--
-- AUTO_INCREMENT for table `order_table`
--
ALTER TABLE `order_table`
  MODIFY `order_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;




index.php


In this file, you can find front-end or client side code of this tutorial. Here we have make one HTML form for select CSV file from local computer, and by using Ajax script we have send selected CSV file to import.php server script by using FormData() object. For select only CSV file, here we have use accept=".csv" attribute.


<!DOCTYPE html>
<html>
 <head>
  <title>How to Import Large CSV File in Multiple Mysql table</title>  
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
 </head>
 <body>
  
  <br />
  <br />
  <div class="container">
   <h1 align="center">How to Import Large CSV File in Multiple Mysql table</h1>
   <br />
   <div class="panel panel-default">
    <div class="panel-heading">
     <h3 class="panel-title">Import Large CSV File Data into Multiple Table</h3>
    </div>
      <div class="panel-body">
       <span id="message"></span>
       <form id="sample_form" method="POST" enctype="multipart/form-data" class="form-horizontal">
        <div class="form-group">
         <label class="col-md-4 control-label">Select CSV File</label>
         <input type="file" name="file" id="file" accept=".csv" />
        </div>
        <div class="form-group" align="center">
         <input type="hidden" name="hidden_field" value="1" />
         <input type="submit" name="import" id="import" class="btn btn-info" value="Import" />
        </div>
       </form>
      </div>
     </div>
  </div>
 </body>
</html>

<script>
 
 $(document).ready(function(){

  $('#sample_form').on('submit', function(event){
   $('#message').html('');
   event.preventDefault();
   $.ajax({
    url:"import.php",
    method:"POST",
    data: new FormData(this),
    dataType:"json",
    contentType:false,
    cache:false,
    processData:false,
    success:function(data)
    {
     $('#message').html('<div class="alert alert-success">'+data.success+'</div>');
     $('#sample_form')[0].reset();
    }
   })
  });

 });
</script>


import.php


This is PHP script file, which will received Ajax request with CSV file, and this script will read CSV file data and import that CSV file data into multiple mysql table by using Mysql LOAD FILE command.

Below you can find PHP script which will first make database connection, and at the time making database connection we have to set PDO::MYSQL_ATTR_LOCAL_INFILE this method with true value. Without using this method we cannon read CSV file from Mysql command. So, this is required at the time of making database connection in PHP PDO, if we want to import CSV large file by using MYSQL LOAD FILE command.

After this you can find query with LOAD DATA LOCAL INFILE command, it will read CSV file data from temporary location of selected CSV file. First it will import data into customer table, and after this it will import data into order table from same selected CSV file.


<?php

if(!empty($_FILES['file']['name']))
{
 $connect = new PDO("mysql:host=localhost;dbname=testing;", "root", "", array(
        PDO::MYSQL_ATTR_LOCAL_INFILE => true,
    ));

 $total_row = count(file($_FILES['file']['tmp_name']));

 $file_location = str_replace("\\", "/", $_FILES['file']['tmp_name']);

 $query_1 = '
 LOAD DATA LOCAL INFILE "'.$file_location.'" IGNORE 
 INTO TABLE customer_table 
 FIELDS TERMINATED BY "," 
 LINES TERMINATED BY "\r\n" 
 IGNORE 1 LINES 
 (@column1,@column2,@column3,@column4) 
 SET customer_first_name = @column1, customer_last_name = @column2,  customer_email = @column3, customer_gender = @column4
 ';

 $statement = $connect->prepare($query_1);

 $statement->execute();

 $query_2 = "
 SELECT MAX(customer_id) as customer_id FROM customer_table
 ";

 $statement = $connect->prepare($query_2);

 $statement->execute();

 $result = $statement->fetchAll();

 $customer_id = 0;

 foreach($result as $row)
 {
  $customer_id = $row['customer_id'];
 }

 $first_customer_id = $customer_id - $total_row;

 $first_customer_id = $first_customer_id + 1;

 $query_3 = 'SET @customer_id:='.$first_customer_id.'';

 $statement = $connect->prepare($query_3);

 $statement->execute();

 $query_4 = '
 LOAD DATA LOCAL INFILE "'.$file_location.'" IGNORE 
 INTO TABLE order_table 
 FIELDS TERMINATED BY "," 
 LINES TERMINATED BY "\r\n" 
 IGNORE 1 LINES 
 (@column1,@column2,@column3,@column4,@column5,@column6,@column7) 
 SET customer_id = @customer_id:=@customer_id+1, product_name = @column5,  product_price = @column6, order_date = @column7
 ';

 $statement = $connect->prepare($query_4);

 $statement->execute();

 $output = array(
  'success' => 'Total <b>'.$total_row.'</b> Data imported'
 );

 echo json_encode($output);
}

?>


So, from this tutorial you get the solution of How can we import large data from CSV file into Multiple mysql table. Above you can get the complete source code this tutorial, So, I hope you have understand this topic and learn the problem of importing large CSV file data into multiple mysql table.

Tuesday, 24 December 2019

Pagination in Laravel 6 with Next And Previous Button using Ajax



If you want to make Pagination in Laravel 6 on with Next and Previous Button Link, then this tutorial is for you. In this post, you can learn How to make Pagination only with Next and Previous Button Link in Laravel using Ajax. Here we will create customize next and previous pagination link in Laravel 6 framework using Ajax.

As Web Developer, we have know Pagination is a one type of design pattern, which has been widely used in most of web site of displaying content on web page. Pagination is a method of dividing large amount of content into different small piece and display large data into small pieces on web page, and suppose user want to view more data, then by using navigation option it can view next part of web content on web page.

There are different way we can use pagination in our web application. Some web developer has use divide content into different page number with navigation link for go to that page number content, some has use drop down list with option of page number, User has to select page number and he can go to data of that web page. And some one has use previous and next page link for go to next or previous page link. So, there is many different ways we can use pagination feature in our web application.

In this tutorial, we will make pagination with next and previous button link in Laravel 6 framework using Ajax. Laravel 6 framework has inbuilt pagination library for make pagination link. But here we want to add next and previous button link in pagination, For this here we can use simplePaginate() method in Laravel 6 framework. By using this eloquent simplePagiante() method we can add simple pagination with only previous and next button link.

But we want to provide more user experience in Laravel 6 pagination. So here we have use also use Ajax web technology. By using Ajax with Laravel 6 pagination, next and previous page data will be load without refresh of web page. So, if you are willing to add pagination with next and previous button link in Laravel 6 using Ajax, then you have to follow below step.




  1. Install Laravel 6 framework

  2. Make Database Connection

  3. Create Controller

  4. Create View Blade File

  5. Set Route

  6. Run Laravel Application


Install Laravel 6 framework


If want to developed application in Laravel, so first we want to download Laravel 6 framework and install in our local computer.

For this we have to go command prompt, and then after go to directoy in which we want to download and install this framwork and run following command.


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


Make Database Connection


Once Laravel framework has been install in define directory, first we want to make database connection. For this we have open .env file and in this file we have to define Mysql database configuration, which you can find below and it will make database connection.


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


After making database connection, now we have to make one table with some data in Mysql database. For this you have to run following sql script. It will make table with some sample data in Mysql database.


--
-- Database: `testing`
--

-- --------------------------------------------------------

--
-- Table structure for table `sample_datas`
--

CREATE TABLE `sample_datas` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `first_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `last_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `sample_datas`
--

INSERT INTO `sample_datas` (`id`, `first_name`, `last_name`, `created_at`, `updated_at`) VALUES
(1, 'John', 'Smith', '2019-10-11 21:39:09', '2019-10-11 21:39:09'),
(2, 'Peter', 'Parker', '2019-10-11 21:39:09', '2019-10-11 21:39:09'),
(3, 'Larry', 'Degraw', '2019-10-11 21:39:09', '2019-10-11 21:39:09'),
(5, 'Susan', 'Diener', '2019-10-14 00:30:00', '2019-10-14 00:30:00'),
(6, 'William', 'Batiste', '2019-10-14 00:30:00', '2019-10-14 00:30:00'),
(7, 'Butler', 'Tucker', '2019-10-14 00:30:00', '2019-10-19 03:24:32'),
(8, 'Eva', 'King', '2019-10-14 00:30:00', '2019-10-14 00:30:00'),
(9, 'Dorothy', 'Hays', '2019-10-14 03:30:00', '2019-10-14 03:30:00'),
(10, 'Nannie', 'Ayers', '2019-10-14 03:30:00', '2019-10-14 03:30:00'),
(11, 'Gerald', 'Brown', '2019-10-14 04:30:00', '2019-10-14 04:30:00'),
(12, 'Judith', 'Smith', '2019-10-14 04:30:00', '2019-10-14 04:30:00'),
(14, 'Delores', 'Schumacher', '2019-10-14 13:30:00', '2019-10-14 13:30:00'),
(15, 'Gloria', 'Romero', '2019-10-14 06:30:00', '2019-10-14 06:30:00'),
(17, 'Paul', 'Pate', '2019-10-14 13:30:00', '2019-10-14 13:30:00'),
(18, 'Ryan', 'Hoang', '2019-10-14 13:30:00', '2019-10-14 13:30:00'),
(19, 'Dixie', 'Smith', '2019-10-17 06:52:21', '2019-10-17 06:52:21'),
(20, 'Jack', 'Smith', '2019-10-17 23:22:30', '2019-10-19 00:39:56'),
(22, 'Ronald', 'Derby', '2019-10-18 00:00:01', '2019-10-18 00:00:01');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `sample_datas`
--
ALTER TABLE `sample_datas`
  ADD PRIMARY KEY (`id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `sample_datas`
--
ALTER TABLE `sample_datas`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=24;




Create Controller


In Laravel framework, for handle http request we have to make controller class. For this we have to command prompt and run following command.


php artisan make:controller PaginationController


This command will make PaginationController.php file in app/Http/Controllers folder. In this class first we have to add use DB; statement, by using this statement we can use Laravel query builder class for database related operation. In this class we have make following method.
  • index() - This is the root method of this class. This method will fetch five data from Mysql table. And then after it will load that data in pagination_parent.blade.php view file.
  • fetch(Request $request) - This method will received Ajax request for fetch next five data from Mysql table. Here we have use simplePaginate() method for make pagination with Next and Previous button link. And lastly it will load data in pagination_child.blade.php file.

app/Http/Controllers/PaginationController.php

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use DB;

class PaginationController extends Controller
{
    function index()
    {
     $data = DB::table('sample_datas')->simplePaginate(5);
        return view('pagination_parent', compact('data'));
    }

    function fetch(Request $request)
    {
     if($request->ajax())
     {
      $data = DB::table('sample_datas')->simplePaginate(5);
         return view('pagination_child', compact('data'))->render();
     }
    }
}
?>


Create View Blade File


For display output in the form of HTML, In Laravel we have to create view blade file. In Laravel view file has been use blade templating engine for convert output in HTML format and view file has been store under resources/views folder.Here we have make following view file.

resources/views/pagination_parent.blade.php

<html>
 <head>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Laravel 6 Pagination with Next Previous Button Link using Ajax</title>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
 </head>
 <body>
  <div class="container">    
     <br />
     <h3 align="center">Laravel 6 Pagination with Previous Next Button Link using Ajax</h3>
     <br />
     @csrf
     <div class="table-responsive" id="table_data">
    @include('pagination_child')
   </div>
        </div>
 </body>
</html>


<script>
$(document).ready(function(){

 $(document).on('click', '.page-link', function(event){
    event.preventDefault(); 
    var page = $(this).attr('href').split('page=')[1];
    fetch_data(page);
 });

 function fetch_data(page)
 {
  var _token = $("input[name=_token]").val();
  $.ajax({
      url:"{{ route('pagination.fetch') }}",
      method:"POST",
      data:{_token:_token, page:page},
      success:function(data)
      {
       $('#table_data').html(data);
      }
    });
 }

});
</script>




resources/views/pagination_child.blade.php

<div class="table-responsive">
    <table class="table table-striped table-bordered">
        <tr>
            <th>First Name</th>
            <th>Last Name</th>
        </tr>
        @foreach($data as $row)
        <tr>
            <td>{{ $row->first_name }}</td>
            <td>{{ $row->last_name }}</td>
        </tr>
        @endforeach
    </table>

    {!! $data->links() !!}
</div>


Set Route


In Laravel we have to set the route of controller method for display result on web page. For this we have to open routes/web.php file and in this file we have to define route.

routes/web.php

<?php

Route::get('/pagination', 'PaginationController@index');

Route::post('pagination/fetch', 'PaginationController@fetch')->name('pagination.fetch');

?>


Run Laravel Application


Once all code is ready, now we want to run Laravel application. For this first we have to go command prompt and run following command.


php artisan serve


This command will run Laravel server and provide use base url of laravel application. For test above code you have to run following url in your browser.


http://127.0.0.1:8000/pagination


So, this is step by step process for creating Pagination with Next and Previous button link in Laravel 6 using Ajax. So, We hope this tutorial will help you to learn this topic.