💄 Ajoute la pagination

This commit is contained in:
Clement Desmidt 2020-03-17 09:52:23 +01:00
parent 1a6677b8aa
commit 516d6d1d34
4 changed files with 6 additions and 3 deletions

View File

@ -44,7 +44,7 @@ class DashboardController extends Controller
$image_counts = Post::where('user_id', Auth::user()->getAuthIdentifier())
->where('image', '!=', 'null')
->count();
$posts = Post::where('user_id', $user_id)->orderBy('date_post', 'DESC')->limit(9)->get();
$posts = Post::where('user_id', $user_id)->orderBy('date_post', 'DESC')->paginate(9);
$today_post = Post::whereDate('date_post', '=', $today->format('Y-m-d'))
->where('user_id', $user_id)
->count();

View File

@ -51,7 +51,7 @@ class ImageController extends Controller
$posts_with_image = Post::where('user_id', Auth::user()->getAuthIdentifier())
->where('image', '!=', 'null')
->orderBy('created_at', 'desc')
->paginate(30);
->paginate(9);
return view('gallery.my', [
'posts' => $posts_with_image,

View File

@ -28,6 +28,9 @@
</div>
</div>
@endforeach
<div class="col-sm-12">
<?php echo $posts->render(); ?>
</div>
</div>
</div>
@endsection

View File

@ -135,7 +135,7 @@
</div>
</div>
@endforeach
<?php echo $posts->render(); ?>
</div>
</div>
@endsection