simple paginate

Submitted by PunnaRao - 3 years ago

simple paginate using table from database and displaying in blade

//---route
Route::resource('pagination', 'PaginationController');
//---controller
public function index()//sinpet in controller
    {
        $users = DB::table('signup_table')->Paginate(1); //here 1 stands for number of records to display in page

        return view('user.index', ['users' => $users]);// sendig $users to blade
    }
    
//-----index.blade

{!! $users->render() !!}//here render method can display the pagination
<div class="container">
    @foreach ($users as $user)
        Email::{{ $user->email }}
        <br>
        <br>
        User Name::{{ $user->full_name }}
    @endforeach
</div>