Skip to content

Commit a365b6b

Browse files
jrd-lewisJakyeRU
andauthored
[2.x] Convert Profile Photo URL attribute to newer syntax (#1237)
* Fixed not redirecting after deleting the user (#1236) * Update HasProfilePhoto.php * Apply StyleCI change --------- Co-authored-by: Jakye <[email protected]>
1 parent 8cbed14 commit a365b6b

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/HasProfilePhoto.php

+6-3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Laravel\Jetstream;
44

5+
use Illuminate\Database\Eloquent\Casts\Attribute;
56
use Illuminate\Http\UploadedFile;
67
use Illuminate\Support\Facades\Storage;
78
use Illuminate\Support\Str;
@@ -56,13 +57,15 @@ public function deleteProfilePhoto()
5657
/**
5758
* Get the URL to the user's profile photo.
5859
*
59-
* @return string
60+
* @return \Illuminate\Database\Eloquent\Casts\Attribute
6061
*/
61-
public function getProfilePhotoUrlAttribute()
62+
public function profilePhotoUrl(): Attribute
6263
{
63-
return $this->profile_photo_path
64+
return Attribute::get(function () {
65+
return $this->profile_photo_path
6466
? Storage::disk($this->profilePhotoDisk())->url($this->profile_photo_path)
6567
: $this->defaultProfilePhotoUrl();
68+
});
6669
}
6770

6871
/**

src/Http/Livewire/DeleteUserForm.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function deleteUser(Request $request, DeletesUsers $deleter, StatefulGuar
6969
$request->session()->regenerateToken();
7070
}
7171

72-
return redirect(config('fortify.redirects.logout', '/'));
72+
return redirect(config('fortify.redirects.logout') ?? '/');
7373
}
7474

7575
/**

0 commit comments

Comments
 (0)