UpdateUserRequest::rules()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 9
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 6
nc 1
nop 0
dl 9
loc 9
rs 9.6666
c 1
b 0
f 0
1
<?php
2
3
namespace Acacha\Users\Http\Requests;
4
5
use Auth;
6
use Illuminate\Foundation\Http\FormRequest;
7
8
/**
9
 * Class UpdateUserRequest.
10
 *
11
 * @package Acacha\Users\Http\Requests
12
 */
13 View Code Duplication
class UpdateUserRequest extends FormRequest
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
14
{
15
    /**
16
     * Determine if the user is authorized to make this request.
17
     *
18
     * @return bool
19
     */
20
    public function authorize()
21
    {
22
        return Auth::user()->can('edit-users');
23
    }
24
25
    /**
26
     * Get the validation rules that apply to the request.
27
     *
28
     * @return array
29
     */
30
    public function rules()
31
    {
32
        return [
33
            'name'     => 'sometimes|required|max:255',
34
            'username' => 'sometimes|required|max:255|unique:users',
35
            'email' => 'sometimes|required|email|max:255|unique:users',
36
            'password' => 'sometimes|required|min:6'
37
        ];
38
    }
39
}
40