fix: prevent display of non-existing profiles

This commit is contained in:
2022-04-08 17:26:51 +01:00
parent 3670fc575b
commit 85962de188
2 changed files with 40 additions and 29 deletions

View File

@@ -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);