Delete   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 6
c 1
b 0
f 0
dl 0
loc 31
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A authorize() 0 3 2
A rules() 0 4 1
A messages() 0 4 1
1
<?php
2
3
namespace Itstructure\LaRbac\Http\Requests;
4
5
use Illuminate\Foundation\Http\FormRequest;
6
7
/**
8
 * Class Delete
9
 *
10
 * @package Itstructure\LaRbac\Http\Requests
11
 *
12
 * @author Andrey Girnik <[email protected]>
13
 */
14
class Delete 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 !empty(config('rbac.routesMainPermission')) ? $this->user()->can(config('rbac.routesMainPermission')) : 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
            'items' => 'required|array',
35
        ];
36
    }
37
38
    /**
39
     * @return array
40
     */
41
    public function messages()
42
    {
43
        return [
44
            'items.required' => __('rbac::validation.required_to_delete'),
45
        ];
46
    }
47
}
48