jhansi's avatar

I want to display my page numbers at bottom in laravel 5.3.

it is displaying at top as follows: « 1 2 » My code is: usercontroller.php

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use App\User;
class UserController extends Controller
{
    public function index(){
        $users = DB::table('users')->Paginate(10);
    return view('index', ['users' => $users]);
    }
}

index.blade.php

<html>
<Title> Users Registered</Title>
<body>


   <table  border="2" style= "background-color: #84ed86; color: #761a9b; margin: 0 auto;" >    

   <tr>
        <th>Date</th>
        <th>Project</th>
        <th>TicketNumber</th>
        <th>Ticketsubject</th>
        <th>Timein</th>
        <th>Timeout</th>
   </tr>
   @foreach ($users as $user) 
   <tr>
        <td>{{ $user->Date }}</td>
        <td>{{ $user->Project }}</td>
        <td>{{ $user->TicketNumber }}</td>
        <td>{{ $user->TicketSubject }}</td>
        <td>{{ $user->Timein }}</td>
        <td>{{ $user->Timeout }}</td>       
    </tr>
    @endforeach
   {{ $users->links() }}
</table>
</body>
</html>
0 likes
10 replies
mercuryseries's avatar

@Jhansi Try to move {{ $users->links() }} after </table>

Btw it's DB::table('users')->paginate(10); with a minus p.

1 like
jhansi's avatar

But it is displaying as:

«
1
2
»

With bullets what to do and how to arrange it horizontally without bullets without using bootstrap?

ottoszika's avatar

Laravel's default pagination presenter is based on Bootstrap. If that's all you have in index.blade.php you should include the CSS.

jhansi's avatar

I am using bootstrap what changes i have to make?please tell me

jhansi's avatar

But it is displaying as:

«
1
2
»

With bullets what to do and how to arrange it horizontally without bullets and bootstrap?

mercuryseries's avatar
Level 17

@Jhansi Try to load Bootstrap for example from the cdn like

<!DOCTYPE html>
<html>
<head>
<title> Users Registered</title>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
</head>
<body>


   <table  border="2" style= "background-color: #84ed86; color: #761a9b; margin: 0 auto;" >    

   <tr>
        <th>Date</th>
        <th>Project</th>
        <th>TicketNumber</th>
        <th>Ticketsubject</th>
        <th>Timein</th>
        <th>Timeout</th>
   </tr>
   @foreach ($users as $user) 
   <tr>
        <td>{{ $user->Date }}</td>
        <td>{{ $user->Project }}</td>
        <td>{{ $user->TicketNumber }}</td>
        <td>{{ $user->TicketSubject }}</td>
        <td>{{ $user->Timein }}</td>
        <td>{{ $user->Timeout }}</td>       
    </tr>
    @endforeach
</table>
{{ $users->links() }}
</body>
</html>
1 like
jhansi's avatar

How to align pagination number at centre?

jhansi's avatar

just add after table completion as

<div class="text-center">

Please or to participate in this conversation.