-
-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
293 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\Guest; | ||
|
||
use App\Enums\ModelAttribute; | ||
use App\Http\Controllers\Controller; | ||
use App\Models\Link; | ||
use App\Models\LinkList; | ||
use App\Models\Note; | ||
use App\Models\Tag; | ||
use App\Models\User; | ||
|
||
class UserController extends Controller | ||
{ | ||
public function show(User $user) | ||
{ | ||
if (usersettings('profile_is_public', $user->id) === false) { | ||
abort(404); | ||
} | ||
|
||
$links = Link::byUser($user->id) | ||
->whereVisibility(ModelAttribute::VISIBILITY_PUBLIC) | ||
->latest() | ||
->take(10) | ||
->paginate(pageName: 'link_page'); | ||
|
||
$lists = LinkList::byUser($user->id) | ||
->whereVisibility(ModelAttribute::VISIBILITY_PUBLIC) | ||
->latest() | ||
->take(10) | ||
->paginate(pageName: 'link_page'); | ||
|
||
$tags = Tag::byUser($user->id) | ||
->whereVisibility(ModelAttribute::VISIBILITY_PUBLIC) | ||
->latest() | ||
->take(10) | ||
->paginate(pageName: 'link_page'); | ||
|
||
$stats = [ | ||
'total_links' => Link::byUser($user->id)->whereVisibility(ModelAttribute::VISIBILITY_PUBLIC)->count(), | ||
'total_lists' => LinkList::byUser($user->id)->whereVisibility(ModelAttribute::VISIBILITY_PUBLIC)->count(), | ||
'total_tags' => Tag::byUser($user->id)->whereVisibility(ModelAttribute::VISIBILITY_PUBLIC)->count(), | ||
'total_notes' => Note::byUser($user->id)->whereVisibility(ModelAttribute::VISIBILITY_PUBLIC)->count(), | ||
]; | ||
|
||
return view('guest.users.show', [ | ||
'user' => $user, | ||
'links' => $links, | ||
'lists' => $lists, | ||
'tags' => $tags, | ||
'stats' => $stats, | ||
]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
@extends('layouts.app') | ||
|
||
@section('content') | ||
|
||
<div class="card"> | ||
<div class="card-header"> | ||
@lang('user.user') | ||
</div> | ||
<div class="card-body"> | ||
<h2 class="mb-0">{{ $user->name }}</h2> | ||
</div> | ||
</div> | ||
|
||
<div class="row"> | ||
<div class="col-12 col-md-7"> | ||
|
||
<div class="card mt-4"> | ||
<div class="card-header"> | ||
@lang('link.recent_links') | ||
</div> | ||
|
||
<ul class="list-group list-group-flush"> | ||
@forelse($links as $link) | ||
<a href="{{ $link->url }}" class="list-group-item list-group-item-action one-line"> | ||
{!! $link->getIcon('me-1') !!} | ||
{{ $link->title }} | ||
</a> | ||
@empty | ||
<li class="list-group-item text-muted"> | ||
@lang('linkace.no_results_found', ['model' => trans('link.links')]) | ||
</li> | ||
@endforelse | ||
</ul> | ||
</div> | ||
|
||
</div> | ||
<div class="col-12 col-md-5"> | ||
|
||
<div class="card mt-4"> | ||
<div class="card-header"> | ||
@lang('stats.stats') | ||
</div> | ||
|
||
<ul class="list-group list-group-flush"> | ||
<li class="list-group-item d-flex justify-content-between align-items-center"> | ||
<span class="me-1">@lang('stats.total_links')</span> | ||
<span class="badge bg-secondary">{{ $stats['total_links'] }}</span> | ||
</li> | ||
<li class="list-group-item d-flex justify-content-between align-items-center"> | ||
<span class="me-1">@lang('stats.total_lists')</span> | ||
<span class="badge bg-secondary">{{ $stats['total_lists'] }}</span> | ||
</li> | ||
<li class="list-group-item d-flex justify-content-between align-items-center"> | ||
<span class="me-1">@lang('stats.total_tags')</span> | ||
<span class="badge bg-secondary">{{ $stats['total_tags'] }}</span> | ||
</li> | ||
<li class="list-group-item d-flex justify-content-between align-items-center"> | ||
<span class="me-1">@lang('stats.total_notes')</span> | ||
<span class="badge bg-secondary">{{ $stats['total_notes'] }}</span> | ||
</li> | ||
</ul> | ||
</div> | ||
|
||
<div class="card mt-4"> | ||
<div class="card-header"> | ||
@lang('list.recent_lists') | ||
</div> | ||
|
||
<div class="card-body"> | ||
@forelse($lists as $list) | ||
<a href="{{ route('guest.lists.show', ['list' => $list]) }}" class="btn btn-light btn-sm m-1"> | ||
{{ $list->name }} | ||
</a> | ||
@empty | ||
<div class="text-muted"> | ||
@lang('linkace.no_results_found', ['model' => trans('list.lists')]) | ||
</div> | ||
@endforelse | ||
</div> | ||
</div> | ||
|
||
<div class="card mt-4"> | ||
<div class="card-header"> | ||
@lang('tag.recent_tags') | ||
</div> | ||
|
||
<div class="card-body"> | ||
@forelse($tags as $tag) | ||
<a href="{{ route('guest.tags.show', ['tag' => $tag]) }}" class="btn btn-light btn-sm m-1"> | ||
{{ $tag->name }} | ||
</a> | ||
@empty | ||
<div class="text-muted"> | ||
@lang('linkace.no_results_found', ['model' => trans('tag.tags')]) | ||
</div> | ||
@endforelse | ||
</div> | ||
</div> | ||
|
||
</div> | ||
</div> | ||
|
||
@endsection |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.