Add authorization check

This commit is contained in:
Marcus Moore
2025-05-22 15:02:14 -07:00
parent 932b589bd9
commit 8c90efe745

View File

@@ -2,12 +2,22 @@
'user'
])
@if ($user)
@if (! $user->trashed())
{{-- if the user is in database but soft-deleted --}}
<a href="{{ route('users.show', $user->id) }}">{{ $user->present()->fullName() }}</a>
@if($user)
@can('view', $user)
@if(! $user->trashed())
{{-- if the user is in database but soft-deleted --}}
<a href="{{ route('users.show', $user->id) }}">{{ $user->present()->fullName() }}</a>
@else
{{-- if the user exists --}}
<s><a href="{{ route('users.show', $user->id) }}">{{ $user->present()->fullName() }}</a></s>
@endif
@else
{{-- if the user exists --}}
<s><a href="{{ route('users.show', $user->id) }}">{{ $user->present()->fullName() }}</a></s>
@endif
@if(! $user->trashed())
{{-- if the user is in database but soft-deleted --}}
<span>{{ $user->present()->fullName() }}</span>
@else
{{-- if the user exists --}}
<s><span>{{ $user->present()->fullName() }}</span></s>
@endif
@endcan
@endif