@@ 8-40 (lines=33) @@ | ||
5 | use Afrittella\BackProject\Repositories\Menus; |
|
6 | use Illuminate\Foundation\Http\FormRequest; |
|
7 | ||
8 | class MenuEdit extends FormRequest |
|
9 | { |
|
10 | protected $menus; |
|
11 | public function __construct(array $query = array(), array $request = array(), array $attributes = array(), array $cookies = array(), array $files = array(), array $server = array(), $content = null, Menus $menus) |
|
12 | { |
|
13 | parent::__construct($query, $request, $attributes, $cookies, $files, $server, $content); |
|
14 | $this->menus = $menus; |
|
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 \Auth::check(); |
|
24 | } |
|
25 | ||
26 | /** |
|
27 | * Get the validation rules that apply to the request. |
|
28 | * |
|
29 | * @return array |
|
30 | */ |
|
31 | public function rules() |
|
32 | { |
|
33 | $menu = $this->menus->find($this->route('menu')); |
|
34 | ||
35 | return [ |
|
36 | 'name' => 'required|max:255|unique:menus,name,'.$menu->id, |
|
37 | 'title' => 'required|max:255', |
|
38 | ]; |
|
39 | } |
|
40 | } |
|
41 |
@@ 10-44 (lines=35) @@ | ||
7 | use Afrittella\BackProject\Repositories\Permissions; |
|
8 | use Illuminate\Container\Container as App; |
|
9 | ||
10 | class PermissionEdit extends FormRequest |
|
11 | { |
|
12 | protected $permissions; |
|
13 | public function __construct(array $query = array(), array $request = array(), array $attributes = array(), array $cookies = array(), array $files = array(), array $server = array(), $content = null, Permissions $permissions) |
|
14 | { |
|
15 | parent::__construct($query, $request, $attributes, $cookies, $files, $server, $content); |
|
16 | $this->permissions = $permissions; |
|
17 | } |
|
18 | ||
19 | /** |
|
20 | * Determine if the user is authorized to make this request. |
|
21 | * |
|
22 | * @return bool |
|
23 | */ |
|
24 | public function authorize() |
|
25 | { |
|
26 | return \Auth::check(); |
|
27 | } |
|
28 | ||
29 | /** |
|
30 | * Get the validation rules that apply to the request. |
|
31 | * |
|
32 | * @return array |
|
33 | */ |
|
34 | public function rules() |
|
35 | { |
|
36 | ||
37 | //$permissionRepository = new PermissionRepository($this->app); |
|
38 | $permission = $this->permissions->findBy('id', $this->route('permission')); |
|
39 | ||
40 | return [ |
|
41 | 'name' => 'required|max:255|unique:permissions,name,'.$permission->id, |
|
42 | ]; |
|
43 | } |
|
44 | } |
|
45 |
@@ 10-44 (lines=35) @@ | ||
7 | use Afrittella\BackProject\Repositories\Roles; |
|
8 | use Illuminate\Container\Container as App; |
|
9 | ||
10 | class RoleEdit extends FormRequest |
|
11 | { |
|
12 | protected $roles; |
|
13 | public function __construct(array $query = array(), array $request = array(), array $attributes = array(), array $cookies = array(), array $files = array(), array $server = array(), $content = null, Roles $roles) |
|
14 | { |
|
15 | parent::__construct($query, $request, $attributes, $cookies, $files, $server, $content); |
|
16 | $this->roles = $roles; |
|
17 | } |
|
18 | ||
19 | /** |
|
20 | * Determine if the user is authorized to make this request. |
|
21 | * |
|
22 | * @return bool |
|
23 | */ |
|
24 | public function authorize() |
|
25 | { |
|
26 | return \Auth::check(); |
|
27 | } |
|
28 | ||
29 | /** |
|
30 | * Get the validation rules that apply to the request. |
|
31 | * |
|
32 | * @return array |
|
33 | */ |
|
34 | public function rules() |
|
35 | { |
|
36 | ||
37 | //$roleRepository = new RoleRepository($this->app); |
|
38 | $role = $this->roles->findBy('id', $this->route('role')); |
|
39 | ||
40 | return [ |
|
41 | 'name' => 'required|max:255|unique:roles,name,'.$role->id, |
|
42 | ]; |
|
43 | } |
|
44 | } |
|
45 |
@@ 10-45 (lines=36) @@ | ||
7 | use Afrittella\BackProject\Repositories\Users; |
|
8 | use Illuminate\Container\Container as App; |
|
9 | ||
10 | class UserEdit extends FormRequest |
|
11 | { |
|
12 | protected $users; |
|
13 | public function __construct(array $query = array(), array $request = array(), array $attributes = array(), array $cookies = array(), array $files = array(), array $server = array(), $content = null, Users $users) |
|
14 | { |
|
15 | parent::__construct($query, $request, $attributes, $cookies, $files, $server, $content); |
|
16 | $this->users = $users; |
|
17 | } |
|
18 | ||
19 | /** |
|
20 | * Determine if the user is authorized to make this request. |
|
21 | * |
|
22 | * @return bool |
|
23 | */ |
|
24 | public function authorize() |
|
25 | { |
|
26 | return \Auth::check(); |
|
27 | } |
|
28 | ||
29 | /** |
|
30 | * Get the validation rules that apply to the request. |
|
31 | * |
|
32 | * @return array |
|
33 | */ |
|
34 | public function rules() |
|
35 | { |
|
36 | ||
37 | //$userRepository = new UserRepository($this->app); |
|
38 | $user = $this->users->findBy('id', $this->route('user')); |
|
39 | ||
40 | return [ |
|
41 | 'username' => 'required|max:255|unique:users,username,'.$user->id, |
|
42 | 'email' => 'required|email|max:255|unique:users,email,'.$user->id, |
|
43 | ]; |
|
44 | } |
|
45 | } |
|
46 |