Update AvatarController

pull/916/head
Daniel Supernault 2019-03-01 14:02:05 -07:00
rodzic fca4562933
commit a2641dfc78
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 0DEF1C662C9033F7
1 zmienionych plików z 1 dodań i 2 usunięć

Wyświetl plik

@ -30,11 +30,10 @@ class AvatarController extends Controller
$dir = $path['root'];
$name = $path['name'];
$public = $path['storage'];
$currentAvatar = storage_path('app/'.$profile->avatar->media_path);
$loc = $request->file('avatar')->storeAs($public, $name);
$avatar = Avatar::firstOrNew(['profile_id' => $profile->id]);
$opath = $avatar->media_path;
$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;