diff --git a/app/Widgets/LatestAwards.php b/app/Widgets/LatestAwards.php new file mode 100644 index 000000000..46189dbf5 --- /dev/null +++ b/app/Widgets/LatestAwards.php @@ -0,0 +1,21 @@ + 5]; + + public function run() + { + $latest_awards = UserAward::with(['award', 'user'])->orderby('created_at', 'desc')->take($this->config['count'])->get(); + + return view('widgets.latest_awards', [ + 'config' => $this->config, + 'awards' => $latest_awards, + ]); + } +} diff --git a/resources/views/layouts/default/widgets/latest_awards.blade.php b/resources/views/layouts/default/widgets/latest_awards.blade.php new file mode 100644 index 000000000..9300ab00f --- /dev/null +++ b/resources/views/layouts/default/widgets/latest_awards.blade.php @@ -0,0 +1,22 @@ +@if($awards->count() > 0) +
Ident | +Name | +Award | +Date | +
{{ optional($a->user)->ident }} | +{{ optional($a->user)->name_private }} | +{{ optional($a->award)->name }} | +{{ $a->created_at->format('d.M.Y H:i') }} | +