@@ 32-52 (lines=21) @@ | ||
29 | * |
|
30 | * @return array |
|
31 | */ |
|
32 | public function rules() |
|
33 | { |
|
34 | $id = $this->route('permission')->id; |
|
35 | return [ |
|
36 | 'name' => [ |
|
37 | 'required', |
|
38 | 'string', |
|
39 | 'regex:/^[\w\s\-]+$/', |
|
40 | 'min:3', |
|
41 | 'max:191', |
|
42 | Rule::unique('permissions')->where('id', '<>', $id), |
|
43 | ], |
|
44 | 'description' => [ |
|
45 | 'required', |
|
46 | 'string', |
|
47 | 'min:3', |
|
48 | 'max:191', |
|
49 | Rule::unique('permissions')->where('id', '<>', $id), |
|
50 | ], |
|
51 | ]; |
|
52 | } |
|
53 | ||
54 | /** |
|
55 | * Get the error messages for the defined validation rules. |
@@ 32-53 (lines=22) @@ | ||
29 | * |
|
30 | * @return array |
|
31 | */ |
|
32 | public function rules() |
|
33 | { |
|
34 | $id = $this->route('role')->id; |
|
35 | return [ |
|
36 | 'name' => [ |
|
37 | 'required', |
|
38 | 'string', |
|
39 | 'regex:/^[\w\s\-]+$/', |
|
40 | 'min:3', |
|
41 | 'max:191', |
|
42 | Rule::unique('roles')->where('id', '<>', $id), |
|
43 | ], |
|
44 | 'description' => [ |
|
45 | 'required', |
|
46 | 'string', |
|
47 | 'min:3', |
|
48 | 'max:191', |
|
49 | Rule::unique('roles')->where('id', '<>', $id), |
|
50 | ], |
|
51 | 'permissions' => 'required|array', |
|
52 | ]; |
|
53 | } |
|
54 | ||
55 | /** |
|
56 | * Get the error messages for the defined validation rules. |