Conditions | 2 |
Paths | 2 |
Total Lines | 18 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 6 |
Changes | 5 | ||
Bugs | 1 | Features | 1 |
1 | <?php |
||
21 | public function update(ChangeUserProfileInfoRequest $request) |
||
22 | { |
||
23 | //TODO: encapsulate all the responses with ApiRequest |
||
24 | $user = Auth::guard('apiauth')->user(); |
||
25 | |||
26 | $user->name = $request->name; |
||
|
|||
27 | $user->email = $request->email; |
||
28 | |||
29 | if ($user->isDirty('email')) { |
||
30 | // mark the email as not verified yet |
||
31 | $user->email_verified_at = null; |
||
32 | // send a verification email |
||
33 | $user->sendEmailVerificationNotification(); |
||
34 | } |
||
35 | |||
36 | $user->save(); |
||
37 | |||
38 | return ApiResponse::send(['status' => 'Account updated successfully'], 1, 200, 'Account updated successfully'); |
||
39 | } |
||
41 |