Completed
Push — master ( e14874...af74be )
by Sergi Tur
09:41
created

APILoggedUserNameController   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 15
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A update() 0 6 1
1
<?php
2
3
namespace Acacha\Users\Http\Controllers;
4
5
use Acacha\Users\Http\Requests\LoggedUserNameUpdate;
6
use Acacha\Users\Http\Requests\LoggedUserPasswordUpdate;
7
use Auth;
8
use Hash;
9
use Illuminate\Http\JsonResponse;
10
11
/**
12
* Class APILoggedUserDataController
13
*
14
* @package Acacha\Users\Http\Controllers
15
*/
16
class APILoggedUserNameController extends Controller {
17
18
    /**
19
     * Update logged user password.
20
     *
21
     * @param LoggedUserNameUpdate $request
22
     * @return JsonResponse|\App\User|null
23
     */
24
    public function update(LoggedUserNameUpdate $request)
25
    {
26
        $user = Auth::user();
27
        $user->update($request->only('name'));
28
        return $user;
29
    }
30
}