Skip to main content

Simple Pagination with Laravel and MySQl

Simple Pagination with Laravel and MySQl

In this Post We Will Explain About is Simple Pagination with Laravel and MySQl With Example and Demo.Welcome on Pakainfo.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to simple pagination in Laravel Example

In this post we will show you Best way to implement pagination code in Laravel with next and previous, hear for dynamic pagination in Laravel with mysql with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

In this Post you can Know simple steps how to make simple pagination in your html blade file. If you are laravel beginners and then it can really help you.so Good news Laravel 5 also provide its own best method for set dynamic pagination.

Also Read :  How to Create, Access and Destroy Sessions in Asp.Net

Laravel Pagination Syntex

//Laravel Auto-Magic Pagination
 Model::paginate(20);
Model::where('mobiles', 2)->paginate(20);
//Laravel simple "Next" and "Previous" button only
 Model::where('mobiles', 2)->simplePaginate(20);
//Laravel create Manual Paginator
 Paginator::make($items, $totalItems, $perPage);
//Laravel Print page navigators in view
$variable->links();

Simple Laravel pagination Example

if you are work on spource code PHP then simple you have to write this long source code for dynemic pagination and render HTML view etc but in php based frameworks Laravel it is very more simple so let’s first of all select data following simple source code way in laravel Controller.

Controller File:

public function getUser()
{
	$stud_data = User::paginate(15);
	return view('users.index',compact('data'));
}

Blade File:

@extends($theme)

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

{!! $stud_data->render() !!}

@endsection

<p>Live24u is the most popular Programming & Web Development blog. Our mission is to provide the best online resources on programming and web development. We deliver the useful and best tutorials for web professionals — developers, programmers, freelancers and site owners. Any visitors of this site are free to browse our tutorials, live demos and download scripts.</p>

You are Most welcome in my youtube Channel Please subscribe my channel. and give me FeedBack.
More Details……
Angularjs Example

Also Read :  Free Unlimited Cloud Storage Types providers Advantages Examples

Example

I hope you have Got What is pagination source code in Laravel with next and previous And how it works.I would Like to have FeedBack From My Blog(Pakainfo.com) readers.Your Valuable FeedBack,Any Question,or any Comments about This Article(Pakainfo.com) Are Most Always Welcome.

Web Developer

Hi, I’m Web developer, PHP developer.Pakainfo.com is the most popular Programming & Web Development blog. Our mission is to provide the best online resources on programming and web development.Any visitors of this site are free to browse our tutorials, live demos, Examples and download scripts.If you have a project that you want to get started, launch quickly, contact me. Email : [email protected]