|
|
|
@ -35,7 +35,6 @@ class AvatarController extends Controller
|
|
|
|
|
$avatar = Avatar::firstOrNew(['profile_id' => $profile->id]);
|
|
|
|
|
$currentAvatar = $avatar->recentlyCreated ? null : storage_path('app/'.$profile->avatar->media_path);
|
|
|
|
|
$avatar->media_path = "$public/$name";
|
|
|
|
|
$avatar->thumb_path = null;
|
|
|
|
|
$avatar->change_count = ++$avatar->change_count;
|
|
|
|
|
$avatar->last_processed_at = null;
|
|
|
|
|
$avatar->save();
|
|
|
|
@ -121,10 +120,7 @@ class AvatarController extends Controller
|
|
|
|
|
$avatar = $profile->avatar;
|
|
|
|
|
|
|
|
|
|
if( $avatar->media_path == 'public/avatars/default.png' ||
|
|
|
|
|
$avatar->thumb_path == 'public/avatars/default.png' ||
|
|
|
|
|
$avatar->media_path == 'public/avatars/default.jpg' ||
|
|
|
|
|
$avatar->thumb_path == 'public/avatars/default.jpg'
|
|
|
|
|
|
|
|
|
|
$avatar->media_path == 'public/avatars/default.jpg'
|
|
|
|
|
) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -133,12 +129,7 @@ class AvatarController extends Controller
|
|
|
|
|
@unlink(storage_path('app/' . $avatar->media_path));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(is_file(storage_path('app/' . $avatar->thumb_path))) {
|
|
|
|
|
@unlink(storage_path('app/' . $avatar->thumb_path));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$avatar->media_path = 'public/avatars/default.jpg';
|
|
|
|
|
$avatar->thumb_path = 'public/avatars/default.jpg';
|
|
|
|
|
$avatar->change_count = $avatar->change_count + 1;
|
|
|
|
|
$avatar->save();
|
|
|
|
|
|
|
|
|
|