UserRolesRequest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A authorize() 0 4 1
A rules() 0 7 1
1
<?php
2
3
namespace Mamikon\RoleManager\Requests;
4
5
use Illuminate\Foundation\Http\FormRequest;
6
use Illuminate\Http\Request;
7
use Mamikon\RoleManager\Models\Permissions;
8
9
/**
10
 * User-Role assignment validation
11
 *
12
 * @category Laravel_Package
13
 * @package  Mamikon\RoleManager
14
 * @author   Mamikon Arakelyan <[email protected]>
15
 * @license  https://github.com/mamikon/role-manager/blob/master/LICENSE.md MIT
16
 * @link     https://github.com/mamikon/role-manager
17
 */
18
class UserRolesRequest extends FormRequest
19
{
20
    /**
21
     * Determine if the user is authorized to make this request.
22
     *
23
     * @return bool
24
     */
25
    public function authorize()
26
    {
27
        return true;
28
    }
29
30
    /**
31
     * Get the validation rules that apply to the request.
32
     *
33
     * @return array
34
     */
35
    public function rules()
36
    {
37
        $return = [
38
            'role.*'=>'exists:'.config('roleManager.rolesTable').',id'
39
        ];
40
        return $return;
41
    }
42
}
43