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...
13
{
14
15
/**
16
* Get the validation rules that apply to the request.
17
*
18
* @return array
19
*/
20
public function rules()
21
{
22
return [
23
'email' => 'required|email|max:40',
24
'id' => 'required|integer', // url parameter
25
];
26
}
27
28
/**
29
* Override the all() to automatically apply validation rules to the URL parameters
30
*
31
* @return array
32
*/
33
public function all()
34
{
35
$data = parent::all();
36
$data['id'] = $this->route('id');
37
38
return $data;
39
}
40
41
/**
42
* Determine if the user is authorized to make this request.
43
*
44
* @return bool
45
*/
46
public function authorize()
47
{
48
// TODO: add policy checking if the user is authorized to set his own Email
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.