From 516d6d1d340e15daefdeca9381b37684aafc7e2d Mon Sep 17 00:00:00 2001 From: Clement Desmidt Date: Tue, 17 Mar 2020 09:52:23 +0100 Subject: [PATCH] :lipstick: Ajoute la pagination --- app/Http/Controllers/DashboardController.php | 2 +- app/Http/Controllers/ImageController.php | 2 +- resources/views/gallery/my.blade.php | 3 +++ resources/views/home.blade.php | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/DashboardController.php b/app/Http/Controllers/DashboardController.php index 28fccd6..66fc05e 100644 --- a/app/Http/Controllers/DashboardController.php +++ b/app/Http/Controllers/DashboardController.php @@ -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(); diff --git a/app/Http/Controllers/ImageController.php b/app/Http/Controllers/ImageController.php index 1d97c85..44ad80b 100644 --- a/app/Http/Controllers/ImageController.php +++ b/app/Http/Controllers/ImageController.php @@ -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, diff --git a/resources/views/gallery/my.blade.php b/resources/views/gallery/my.blade.php index 5f0fca1..fe22ae5 100644 --- a/resources/views/gallery/my.blade.php +++ b/resources/views/gallery/my.blade.php @@ -28,6 +28,9 @@ @endforeach +
+ render(); ?> +
@endsection diff --git a/resources/views/home.blade.php b/resources/views/home.blade.php index ad74dac..f7b2b3f 100644 --- a/resources/views/home.blade.php +++ b/resources/views/home.blade.php @@ -135,7 +135,7 @@ @endforeach - + render(); ?> @endsection