AttachRequest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A authorize() 0 4 1
A rules() 0 12 1
1
<?php
2
3
namespace BBSLab\NovaPermission\Http\Requests;
4
5
use Illuminate\Foundation\Http\FormRequest;
6
use Illuminate\Validation\Rule;
7
8
/**
9
 * Class AttachRequest.
10
 *
11
 * @property array $permissions
12
 * @property bool $attach
13
 */
14
class AttachRequest extends FormRequest
15
{
16
    /**
17
     * Determine if the user is authorized to make this request.
18
     *
19
     * @return bool
20
     */
21
    public function authorize()
22
    {
23
        return true;
24
    }
25
26
    /**
27
     * Get the validation rules that apply to the request.
28
     *
29
     * @return array
30
     */
31
    public function rules()
32
    {
33
        return [
34
            'permissions' => 'required|array',
35
            'permissions.*' => [
36
                'required',
37
                'integer',
38
                Rule::exists(config('permission.table_names.permissions'), 'id'),
39
            ],
40
            'attach' => 'required|boolean',
41
        ];
42
    }
43
}
44