Skip to content

Commit 785dcdf

Browse files
committed
formatting
1 parent c6c7298 commit 785dcdf

File tree

5 files changed

+19
-35
lines changed

5 files changed

+19
-35
lines changed

routes/inertia.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Laravel\Jetstream\Http\Controllers\Inertia\ApiTokenController;
66
use Laravel\Jetstream\Http\Controllers\Inertia\CurrentUserController;
77
use Laravel\Jetstream\Http\Controllers\Inertia\OtherBrowserSessionsController;
8+
use Laravel\Jetstream\Http\Controllers\Inertia\ProfilePhotoController;
89
use Laravel\Jetstream\Http\Controllers\Inertia\TeamController;
910
use Laravel\Jetstream\Http\Controllers\Inertia\TeamMemberController;
1011
use Laravel\Jetstream\Http\Controllers\Inertia\UserProfileController;
@@ -22,7 +23,7 @@
2223
Route::delete('/user', [CurrentUserController::class, 'destroy'])
2324
->name('current-user.destroy');
2425

25-
Route::delete('/user/profile-photo', [CurrentUserController::class, 'deleteProfilePhoto'])
26+
Route::delete('/user/profile-photo', [ProfilePhotoController::class, 'destroy'])
2627
->name('current-user-photo.destroy');
2728

2829
// API...

src/Http/Controllers/Inertia/CurrentUserController.php

-13
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,6 @@
1111

1212
class CurrentUserController extends Controller
1313
{
14-
/**
15-
* Delete the current user profile photo.
16-
*
17-
* @param Request $request
18-
* @return \Illuminate\Http\RedirectResponse
19-
*/
20-
public function deleteProfilePhoto(Request $request)
21-
{
22-
$request->user()->deleteProfilePhoto();
23-
24-
return back()->with('status', 'profile-photo-deleted');
25-
}
26-
2714
/**
2815
* Delete the current user.
2916
*

src/Http/Livewire/UpdateProfileInformationForm.php

+1-5
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,11 @@ public function updateProfileInformation(UpdatesUserProfileInformation $updater)
6262
/**
6363
* Delete user's profile photo.
6464
*
65-
* @param \Laravel\Fortify\Contracts\UpdatesUserProfileInformation $updater
66-
*
6765
* @return void
6866
*/
69-
public function deleteProfilePhoto(UpdatesUserProfileInformation $updater)
67+
public function deleteProfilePhoto()
7068
{
7169
Auth::user()->deleteProfilePhoto();
72-
73-
return redirect()->route('profile.show');
7470
}
7571

7672
/**

stubs/inertia/resources/js/Pages/Profile/UpdateProfileInformationForm.vue

+12-12
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@
3434
Select A New Photo
3535
</jet-secondary-button>
3636

37-
<jet-button type="button" @click.native.prevent="deleteProfilePhoto" v-if="$page.user.profile_photo_path">
38-
Delete Photo
39-
</jet-button>
37+
<jet-secondary-button type="button" class="ml-2" @click.native.prevent="deletePhoto" v-if="$page.user.profile_photo_path">
38+
Remove Photo
39+
</jet-secondary-button>
4040

4141
<jet-input-error :message="form.error('photo')" class="mt-2" />
4242
</div>
@@ -107,14 +107,6 @@
107107
},
108108
109109
methods: {
110-
deleteProfilePhoto() {
111-
this.$inertia.delete('/user/profile-photo', {
112-
preserveScroll: true,
113-
}).then(() => {
114-
this.photoPreview = null
115-
});
116-
},
117-
118110
updateProfileInformation() {
119111
if (this.$refs.photo) {
120112
this.form.photo = this.$refs.photo.files[0]
@@ -137,7 +129,15 @@
137129
};
138130
139131
reader.readAsDataURL(this.$refs.photo.files[0]);
140-
}
132+
},
133+
134+
deletePhoto() {
135+
this.$inertia.delete('/user/profile-photo', {
136+
preserveScroll: true,
137+
}).then(() => {
138+
this.photoPreview = null
139+
});
140+
},
141141
},
142142
}
143143
</script>

stubs/livewire/resources/views/profile/update-profile-information-form.blade.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@
4242
Select A New Photo
4343
</x-jet-secondary-button>
4444

45-
@if($this->user->profile_photo_path)
46-
<x-jet-button type="button" wire:click="deleteProfilePhoto">
47-
Delete Photo
48-
</x-jet-button>
45+
@if ($this->user->profile_photo_path)
46+
<x-jet-secondary-button type="button" class="ml-2" wire:click="deleteProfilePhoto">
47+
Remove Photo
48+
</x-jet-secondary-button>
4949
@endif
5050

5151
<x-jet-input-error for="photo" class="mt-2" />

0 commit comments

Comments
 (0)