fix: prevent display of non-existing profiles
This commit is contained in:
parent
3670fc575b
commit
85962de188
@ -62,6 +62,15 @@ class ProfileController extends Controller
|
||||
|
||||
public function showSingleProfile(User $user)
|
||||
{
|
||||
|
||||
if (is_null($user->profile)) {
|
||||
|
||||
return redirect()
|
||||
->back()
|
||||
->with('error', "This user doesn't have a profile.");
|
||||
|
||||
}
|
||||
|
||||
$socialMediaProfiles = json_decode($user->profile->socialLinks, true);
|
||||
$createdDate = Carbon::parse($user->created_at);
|
||||
|
||||
|
@ -28,6 +28,7 @@
|
||||
<div class="row">
|
||||
|
||||
@foreach ($users as $user)
|
||||
@if (!is_null($user->profile))
|
||||
<div class="col-md-4">
|
||||
<div class="card card-widget widget-user">
|
||||
<div class="widget-user-header bg-secondary">
|
||||
@ -70,6 +71,7 @@
|
||||
</div>
|
||||
<!-- /.widget-user -->
|
||||
</div>
|
||||
@endif
|
||||
@endforeach
|
||||
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user