Skip to content

Instantly share code, notes, and snippets.

@ryanKinoti
Created July 17, 2023 14:48
Show Gist options
  • Save ryanKinoti/46acb572ad4f0f2a48b8437e51f424b6 to your computer and use it in GitHub Desktop.
Save ryanKinoti/46acb572ad4f0f2a48b8437e51f424b6 to your computer and use it in GitHub Desktop.
document/image saving
// Check if there is already a profile picture stored
if ($finduser->profile_picture) {
// Delete the existing profile picture file
Storage::delete($finduser->profile_picture);
}
//procedure for saving profile pictures
$avatarPath = 'public/avatars/employers/' . $user->id . '.jpg';
$avatarContents = file_get_contents($user->getAvatar());
Storage::put($avatarPath, $avatarContents);
$finduser->profile_picture = $avatarPath;
$finduser->google_token = $user->token;
$finduser->save();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment