Skip to content

Commit

Permalink
enh(recently updated): show updatedBy and updated_at
Browse files Browse the repository at this point in the history
  • Loading branch information
bourdaisj committed Jan 18, 2022
1 parent 2aace16 commit bf34136
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/Http/Controllers/PageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));

Expand All @@ -373,6 +374,7 @@ public function showRecentlyUpdated()
return view('common.detailed-listing-paginated', [
'title' => trans('entities.recently_updated_pages'),
'entities' => $pages,
'showUpdatedBy' => true,
]);
}

Expand Down
7 changes: 7 additions & 0 deletions resources/views/entities/list-item.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,11 @@
</div>
@endif

@if(($showUpdatedBy ?? false) && $entity->relationLoaded('updatedBy') && $entity->updatedBy)
{!! trans('entities.meta_updated_name', [
'timeLength' => '<span title="' . $entity->updated_at->toDayDateTimeString() .'">' . $entity->updated_at->diffForHumans() .'</span>',
'user' => e($entity->updatedBy->name)
]) !!}
@endif

@endcomponent

0 comments on commit bf34136

Please sign in to comment.