This is a short pagan guide to laravel 7. Here you will learn the laravel 7 blade example blade. In this article, we will use the laravel 7 code example code. This tutorial will give you a simple laravel 7 example of pagination. follow the clear step of building paganism in laravel 7 example.

We know that environmental cleanup is a key requirement for every project. so if you are just starting out with laravel than you should know how to use pagination in laravel 7 and any other activity you can use with laravel 7 pagination.

In this example I will explain to you from the beginning how to work with laravel pagination. so let's follow the compelling tutorial to create a simple page example with laravel 7.

Add Route : routes/web.php

Route::get('users', 'UserController@index');

Create Controller : app/Http/Controllers/UserController.php

<?php
   
namespace App\Http\Controllers;
   
use Illuminate\Http\Request;
use App\User;
  
class UserController extends Controller
{
    public function index()
    {
        $data = User::paginate(10);
        return view('users',compact('data'));
    }
}

Create Blade File : resources/views/users.blade.php

@extends($theme)
  
@section('content')
  
<table class="table table-bordered">
    <thead>
        <tr>
            <th>Name</th>
            <th width="300px;">Action</th>
        </tr>
    </thead>
    <tbody>
        @if(!empty($data) && $data->count())
            @foreach($data as $key => $value)
                <tr>
                    <td>{{ $value->name }}</td>
                    <td>
                        <button class="btn btn-danger">Delete</button>
                    </td>
                </tr>
            @endforeach
        @else
            <tr>
                <td colspan="10">There are no data.</td>
            </tr>
        @endif
    </tbody>
</table>
   
{!! $data->links() !!}
  
@endsection