From bf341364a998dfd52206a458973ee75aa19f1e01 Mon Sep 17 00:00:00 2001 From: julesdevops Date: Tue, 18 Jan 2022 22:08:01 +0100 Subject: [PATCH] enh(recently updated): show updatedBy and updated_at --- app/Http/Controllers/PageController.php | 4 +++- resources/views/entities/list-item.blade.php | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/PageController.php b/app/Http/Controllers/PageController.php index fc4b463e15f..3f16c677234 100644 --- a/app/Http/Controllers/PageController.php +++ b/app/Http/Controllers/PageController.php @@ -364,7 +364,8 @@ public function destroyDraft(string $bookSlug, int $pageId) */ public function showRecentlyUpdated() { - $pages = Page::visible()->orderBy('updated_at', 'desc') + $pages = Page::visible()->with('updatedBy') + ->orderBy('updated_at', 'desc') ->paginate(20) ->setPath(url('/pages/recently-updated')); @@ -373,6 +374,7 @@ public function showRecentlyUpdated() return view('common.detailed-listing-paginated', [ 'title' => trans('entities.recently_updated_pages'), 'entities' => $pages, + 'showUpdatedBy' => true, ]); } diff --git a/resources/views/entities/list-item.blade.php b/resources/views/entities/list-item.blade.php index aa4f6c1e8ec..77cf91a5ae2 100644 --- a/resources/views/entities/list-item.blade.php +++ b/resources/views/entities/list-item.blade.php @@ -20,4 +20,11 @@ @endif +@if(($showUpdatedBy ?? false) && $entity->relationLoaded('updatedBy') && $entity->updatedBy) + {!! trans('entities.meta_updated_name', [ + 'timeLength' => '' . $entity->updated_at->diffForHumans() .'', + 'user' => e($entity->updatedBy->name) + ]) !!} +@endif + @endcomponent \ No newline at end of file