mirror of
https://github.com/Kovah/LinkAce.git
synced 2025-03-14 19:59:38 +01:00
Add recent tags and lists to the dashboard (#188)
This commit is contained in:
parent
cf750c4a53
commit
1eb10b380d
@ -19,7 +19,17 @@ class DashboardController extends Controller
|
||||
public function index(): View
|
||||
{
|
||||
$recentLinks = Link::byUser(auth()->user()->id)
|
||||
->orderBy('created_at', 'DESC')
|
||||
->latest()
|
||||
->limit(5)
|
||||
->get();
|
||||
|
||||
$recentTags = Tag::byUser(auth()->user()->id)
|
||||
->latest()
|
||||
->limit(5)
|
||||
->get();
|
||||
|
||||
$recentLists = LinkList::byUser(auth()->user()->id)
|
||||
->latest()
|
||||
->limit(5)
|
||||
->get();
|
||||
|
||||
@ -37,6 +47,8 @@ class DashboardController extends Controller
|
||||
|
||||
return view('dashboard', [
|
||||
'recent_links' => $recentLinks,
|
||||
'recent_tags' => $recentTags,
|
||||
'recent_lists' => $recentLists,
|
||||
'stats' => $stats,
|
||||
]);
|
||||
}
|
||||
|
@ -2,8 +2,8 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
|
||||
class FrontController extends Controller
|
||||
{
|
||||
|
@ -3,6 +3,7 @@ return [
|
||||
'list' => 'List',
|
||||
'lists' => 'Lists',
|
||||
'all_lists' => 'All Lists',
|
||||
'recent_lists' => 'Recent Lists',
|
||||
|
||||
'add' => 'Add List',
|
||||
'show' => 'Show List',
|
||||
|
@ -3,6 +3,7 @@ return [
|
||||
'tag' => 'Tag',
|
||||
'tags' => 'Tags',
|
||||
'all_tags' => 'All Tags',
|
||||
'recent_tags' => 'Recent Tags',
|
||||
|
||||
'add' => 'Add Tag',
|
||||
'show' => 'Show Tag',
|
||||
|
@ -152,4 +152,51 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12 col-md-7">
|
||||
|
||||
<div class="card mt-4">
|
||||
<div class="card-header">
|
||||
@lang('list.recent_lists')
|
||||
</div>
|
||||
|
||||
<ul class="list-group list-group-flush">
|
||||
@forelse($recent_lists as $list)
|
||||
<a href="{{ route('lists.show', [$list->id]) }}"
|
||||
class="list-group-item list-group-item-action one-line">
|
||||
{{ $list->name }}
|
||||
</a>
|
||||
@empty
|
||||
<li class="list-group-item text-danger">
|
||||
@lang('linkace.no_results_found', ['model' => trans('list.lists')])
|
||||
</li>
|
||||
@endforelse
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="col-12 col-md-5">
|
||||
|
||||
<div class="card mt-4">
|
||||
<div class="card-header">
|
||||
@lang('tag.recent_tags')
|
||||
</div>
|
||||
|
||||
<ul class="list-group list-group-flush">
|
||||
@forelse($recent_tags as $tag)
|
||||
<a href="{{ route('tags.show', [$tag->id]) }}"
|
||||
class="list-group-item list-group-item-action one-line">
|
||||
{{ $tag->name }}
|
||||
</a>
|
||||
@empty
|
||||
<li class="list-group-item text-danger">
|
||||
@lang('linkace.no_results_found', ['model' => trans('tag.tags')])
|
||||
</li>
|
||||
@endforelse
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endsection
|
||||
|
Loading…
x
Reference in New Issue
Block a user