Skip to content

Commit 88ba53a

Browse files
committed
Fix broken link
1 parent cced887 commit 88ba53a

File tree

2 files changed

+9
-15
lines changed

2 files changed

+9
-15
lines changed

app/Http/Middleware/VerifyAdmins.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@
44

55
use App\Policies\UserPolicy;
66
use App\User;
7-
use Auth;
87
use Closure;
98
use Illuminate\Http\Request;
9+
use Illuminate\Support\Facades\Auth;
1010
use Symfony\Component\HttpKernel\Exception\HttpException;
1111

1212
class VerifyAdmins
1313
{
1414
public function handle(Request $request, Closure $next, $guard = null)
1515
{
16-
if (! Auth::guard($guard)->user()->can(UserPolicy::ADMIN, User::class)) {
17-
throw new HttpException(403, 'Forbidden');
16+
if (Auth::guard($guard)->user()->can(UserPolicy::ADMIN, User::class)) {
17+
return $next($request);
1818
}
1919

20-
return $next($request);
20+
throw new HttpException(403, 'Forbidden');
2121
}
2222
}

resources/views/users/_user_info.blade.php

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
1-
<div class="flex flex-col mb-4 w-full @if(isset($centered) && $centered) items-center @endif">
1+
<div class="flex flex-col mb-4 w-full @if (isset($centered) && $centered) items-center @endif">
22
<div class="mb-4">
3-
@can(App\Policies\UserPolicy::ADMIN, App\User::class)
4-
<a href="{{ route('admin.users.show', $user->username()) }}">
5-
<img src="{{ $user->gravatarUrl($avatarSize ?? 250) }}" class="w-full">
6-
</a>
7-
@else
8-
<a href="{{ route('profile', $user->username()) }}">
9-
<img src="{{ $user->gravatarUrl($avatarSize ?? 250) }}" class="w-full">
10-
</a>
11-
@endcan
3+
<a href="{{ route('profile', $user->username()) }}">
4+
<img src="{{ $user->gravatarUrl($avatarSize ?? 250) }}" class="w-full">
5+
</a>
126
</div>
137

148
<h2 class="text-2xl text-gray-900 mb-4">{{ $user->name() }}</h2>
@@ -27,7 +21,7 @@
2721
@endif
2822
@endcan
2923

30-
@if(Auth::check() && Auth::user()->isAdmin())
24+
@if (Auth::check() && Auth::user()->isAdmin())
3125
@can(App\Policies\UserPolicy::DELETE, $user)
3226
<button type="button" class="button button-danger w-full mb-4" @click.prevent="activeModal = 'deleteUser'">Delete User</button>
3327
@endcan

0 commit comments

Comments
 (0)