celsonery /
db-sync
| 1 | <?php |
||||||
| 2 | |||||||
| 3 | namespace App\Http\Controllers; |
||||||
| 4 | |||||||
| 5 | use App\Http\Requests\ProfileUpdateRequest; |
||||||
| 6 | use Illuminate\Contracts\Auth\MustVerifyEmail; |
||||||
| 7 | use Illuminate\Http\RedirectResponse; |
||||||
| 8 | use Illuminate\Http\Request; |
||||||
| 9 | use Illuminate\Support\Facades\Auth; |
||||||
| 10 | use Illuminate\Support\Facades\Redirect; |
||||||
| 11 | use Inertia\Inertia; |
||||||
| 12 | use Inertia\Response; |
||||||
| 13 | |||||||
| 14 | class ProfileController extends Controller |
||||||
| 15 | { |
||||||
| 16 | /** |
||||||
| 17 | * Display the user's profile form. |
||||||
| 18 | */ |
||||||
| 19 | public function edit(Request $request): Response |
||||||
| 20 | { |
||||||
| 21 | return Inertia::render('Profile/Edit', [ |
||||||
| 22 | 'mustVerifyEmail' => $request->user() instanceof MustVerifyEmail, |
||||||
|
0 ignored issues
–
show
|
|||||||
| 23 | 'status' => session('status'), |
||||||
| 24 | ]); |
||||||
| 25 | } |
||||||
| 26 | |||||||
| 27 | /** |
||||||
| 28 | * Update the user's profile information. |
||||||
| 29 | */ |
||||||
| 30 | public function update(ProfileUpdateRequest $request): RedirectResponse |
||||||
| 31 | { |
||||||
| 32 | $request->user()->fill($request->validated()); |
||||||
|
0 ignored issues
–
show
The method
user() does not exist on App\Http\Requests\ProfileUpdateRequest.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||||||
| 33 | |||||||
| 34 | if ($request->user()->isDirty('email')) { |
||||||
| 35 | $request->user()->email_verified_at = null; |
||||||
| 36 | } |
||||||
| 37 | |||||||
| 38 | $request->user()->save(); |
||||||
| 39 | |||||||
| 40 | return Redirect::route('profile.edit'); |
||||||
| 41 | } |
||||||
| 42 | |||||||
| 43 | /** |
||||||
| 44 | * Delete the user's account. |
||||||
| 45 | */ |
||||||
| 46 | public function destroy(Request $request): RedirectResponse |
||||||
| 47 | { |
||||||
| 48 | $request->validate([ |
||||||
|
0 ignored issues
–
show
The method
validate() does not exist on Illuminate\Http\Request.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||||||
| 49 | 'password' => ['required', 'current_password'], |
||||||
| 50 | ]); |
||||||
| 51 | |||||||
| 52 | $user = $request->user(); |
||||||
| 53 | |||||||
| 54 | Auth::logout(); |
||||||
| 55 | |||||||
| 56 | $user->delete(); |
||||||
| 57 | |||||||
| 58 | $request->session()->invalidate(); |
||||||
|
0 ignored issues
–
show
The method
session() does not exist on Illuminate\Http\Request.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||||||
| 59 | $request->session()->regenerateToken(); |
||||||
| 60 | |||||||
| 61 | return Redirect::to('/'); |
||||||
| 62 | } |
||||||
| 63 | } |
||||||
| 64 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.