Passed
Pull Request — master (#112)
by Ron
17:16
created

UserNotificationsRequest::authorize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace App\Http\Requests\User;
4
5
use App\Models\User;
6
7
use Illuminate\Foundation\Http\FormRequest;
8
9
class UserNotificationsRequest extends FormRequest
10
{
11
    /**
12
     * Determine if the user is authorized to make this request
13
     */
14
    public function authorize()
15
    {
16
        return $this->user()->can('update', User::find($this->user_id));
17
    }
18
19
    /**
20
     * Get the validation rules that apply to the request
21
     */
22
    public function rules()
23
    {
24
        return [
25
            'settingsData' => 'required|array',
26
            'user_id'      => 'required|exists:users',
27
        ];
28
    }
29
}
30