@@ 12-63 (lines=52) @@ | ||
9 | * |
|
10 | * @author Mahmoud Zalt <[email protected]> |
|
11 | */ |
|
12 | class ViewDashboardRequest extends Request |
|
13 | { |
|
14 | ||
15 | /** |
|
16 | * Define which Roles and/or Permissions has access to this request.. |
|
17 | * |
|
18 | * @var array |
|
19 | */ |
|
20 | protected $access = [ |
|
21 | 'roles' => 'admin', |
|
22 | 'permissions' => '', |
|
23 | ]; |
|
24 | ||
25 | /** |
|
26 | * Id's that needs decoding before applying the validation rules. |
|
27 | * |
|
28 | * @var array |
|
29 | */ |
|
30 | protected $decode = [ |
|
31 | ||
32 | ]; |
|
33 | ||
34 | /** |
|
35 | * Defining the URL parameters (`/stores/999/items`) allows applying |
|
36 | * validation rules on them and allows accessing them like request data. |
|
37 | * |
|
38 | * @var array |
|
39 | */ |
|
40 | protected $urlParameters = [ |
|
41 | ||
42 | ]; |
|
43 | ||
44 | /** |
|
45 | * Get the validation rules that apply to the request. |
|
46 | * |
|
47 | * @return array |
|
48 | */ |
|
49 | public function rules() |
|
50 | { |
|
51 | return []; |
|
52 | } |
|
53 | ||
54 | /** |
|
55 | * Determine if the user is authorized to make this request. |
|
56 | * |
|
57 | * @return bool |
|
58 | */ |
|
59 | public function authorize() |
|
60 | { |
|
61 | return $this->hasAccess(); |
|
62 | } |
|
63 | } |
|
64 |
@@ 12-62 (lines=51) @@ | ||
9 | * |
|
10 | * @author Mahmoud Zalt <[email protected]> |
|
11 | */ |
|
12 | class ListAllPermissionsRequest extends Request |
|
13 | { |
|
14 | ||
15 | /** |
|
16 | * Define which Roles and/or Permissions has access to this request.. |
|
17 | * |
|
18 | * @var array |
|
19 | */ |
|
20 | protected $access = [ |
|
21 | 'roles' => 'admin', |
|
22 | 'permissions' => '', |
|
23 | ]; |
|
24 | ||
25 | /** |
|
26 | * Id's that needs decoding before applying the validation rules. |
|
27 | * |
|
28 | * @var array |
|
29 | */ |
|
30 | protected $decode = [ |
|
31 | ||
32 | ]; |
|
33 | ||
34 | /** |
|
35 | * Defining the URL parameters (`/stores/999/items`) allows applying |
|
36 | * validation rules on them and allows accessing them like request data. |
|
37 | * |
|
38 | * @var array |
|
39 | */ |
|
40 | protected $urlParameters = [ |
|
41 | ||
42 | ]; |
|
43 | ||
44 | ||
45 | /** |
|
46 | * @return array |
|
47 | */ |
|
48 | public function rules() |
|
49 | { |
|
50 | return [ |
|
51 | ||
52 | ]; |
|
53 | } |
|
54 | ||
55 | /** |
|
56 | * @return bool |
|
57 | */ |
|
58 | public function authorize() |
|
59 | { |
|
60 | return $this->hasAccess(); |
|
61 | } |
|
62 | } |
|
63 |
@@ 12-61 (lines=50) @@ | ||
9 | * |
|
10 | * @author Mahmoud Zalt <[email protected]> |
|
11 | */ |
|
12 | class ListAllRolesRequest extends Request |
|
13 | { |
|
14 | ||
15 | /** |
|
16 | * Define which Roles and/or Permissions has access to this request.. |
|
17 | * |
|
18 | * @var array |
|
19 | */ |
|
20 | protected $access = [ |
|
21 | 'roles' => 'admin', |
|
22 | 'permissions' => '', |
|
23 | ]; |
|
24 | ||
25 | /** |
|
26 | * Id's that needs decoding before applying the validation rules. |
|
27 | * |
|
28 | * @var array |
|
29 | */ |
|
30 | protected $decode = [ |
|
31 | ||
32 | ]; |
|
33 | ||
34 | /** |
|
35 | * Defining the URL parameters (`/stores/999/items`) allows applying |
|
36 | * validation rules on them and allows accessing them like request data. |
|
37 | * |
|
38 | * @var array |
|
39 | */ |
|
40 | protected $urlParameters = [ |
|
41 | ||
42 | ]; |
|
43 | ||
44 | /** |
|
45 | * @return array |
|
46 | */ |
|
47 | public function rules() |
|
48 | { |
|
49 | return [ |
|
50 | ||
51 | ]; |
|
52 | } |
|
53 | ||
54 | /** |
|
55 | * @return bool |
|
56 | */ |
|
57 | public function authorize() |
|
58 | { |
|
59 | return $this->hasAccess(); |
|
60 | } |
|
61 | } |
|
62 |
@@ 12-62 (lines=51) @@ | ||
9 | * |
|
10 | * @author Mahmoud Zalt <[email protected]> |
|
11 | */ |
|
12 | class DetachPermissionToRoleRequest extends Request |
|
13 | { |
|
14 | ||
15 | /** |
|
16 | * Define which Roles and/or Permissions has access to this request.. |
|
17 | * |
|
18 | * @var array |
|
19 | */ |
|
20 | protected $access = [ |
|
21 | 'roles' => 'admin', |
|
22 | 'permissions' => '', |
|
23 | ]; |
|
24 | ||
25 | /** |
|
26 | * Id's that needs decoding before applying the validation rules. |
|
27 | * |
|
28 | * @var array |
|
29 | */ |
|
30 | protected $decode = [ |
|
31 | ||
32 | ]; |
|
33 | ||
34 | /** |
|
35 | * Defining the URL parameters (`/stores/999/items`) allows applying |
|
36 | * validation rules on them and allows accessing them like request data. |
|
37 | * |
|
38 | * @var array |
|
39 | */ |
|
40 | protected $urlParameters = [ |
|
41 | ||
42 | ]; |
|
43 | ||
44 | /** |
|
45 | * @return array |
|
46 | */ |
|
47 | public function rules() |
|
48 | { |
|
49 | return [ |
|
50 | 'role_name' => 'required|exists:roles,name', |
|
51 | 'permission_name' => 'required|exists:permissions,name', |
|
52 | ]; |
|
53 | } |
|
54 | ||
55 | /** |
|
56 | * @return bool |
|
57 | */ |
|
58 | public function authorize() |
|
59 | { |
|
60 | return $this->hasAccess(); |
|
61 | } |
|
62 | } |
|
63 |
@@ 12-62 (lines=51) @@ | ||
9 | * |
|
10 | * @author Mahmoud Zalt <[email protected]> |
|
11 | */ |
|
12 | class RevokeUserFromRoleRequest extends Request |
|
13 | { |
|
14 | ||
15 | /** |
|
16 | * Define which Roles and/or Permissions has access to this request.. |
|
17 | * |
|
18 | * @var array |
|
19 | */ |
|
20 | protected $access = [ |
|
21 | 'roles' => 'admin', |
|
22 | 'permissions' => '', |
|
23 | ]; |
|
24 | ||
25 | /** |
|
26 | * Id's that needs decoding before applying the validation rules. |
|
27 | * |
|
28 | * @var array |
|
29 | */ |
|
30 | protected $decode = [ |
|
31 | 'user_id', |
|
32 | ]; |
|
33 | ||
34 | /** |
|
35 | * Defining the URL parameters (`/stores/999/items`) allows applying |
|
36 | * validation rules on them and allows accessing them like request data. |
|
37 | * |
|
38 | * @var array |
|
39 | */ |
|
40 | protected $urlParameters = [ |
|
41 | ||
42 | ]; |
|
43 | ||
44 | /** |
|
45 | * @return array |
|
46 | */ |
|
47 | public function rules() |
|
48 | { |
|
49 | return [ |
|
50 | 'roles_names' => 'required|exists:roles,name', |
|
51 | 'user_id' => 'required|exists:users,id', |
|
52 | ]; |
|
53 | } |
|
54 | ||
55 | /** |
|
56 | * @return bool |
|
57 | */ |
|
58 | public function authorize() |
|
59 | { |
|
60 | return $this->hasAccess(); |
|
61 | } |
|
62 | } |
|
63 |
@@ 12-61 (lines=50) @@ | ||
9 | * |
|
10 | * @author Mahmoud Zalt <[email protected]> |
|
11 | */ |
|
12 | class GetPermissionRequest extends Request |
|
13 | { |
|
14 | ||
15 | /** |
|
16 | * Define which Roles and/or Permissions has access to this request.. |
|
17 | * |
|
18 | * @var array |
|
19 | */ |
|
20 | protected $access = [ |
|
21 | 'roles' => 'admin', |
|
22 | 'permissions' => '', |
|
23 | ]; |
|
24 | ||
25 | /** |
|
26 | * Id's that needs decoding before applying the validation rules. |
|
27 | * |
|
28 | * @var array |
|
29 | */ |
|
30 | protected $decode = [ |
|
31 | ||
32 | ]; |
|
33 | ||
34 | /** |
|
35 | * Defining the URL parameters (`/stores/999/items`) allows applying |
|
36 | * validation rules on them and allows accessing them like request data. |
|
37 | * |
|
38 | * @var array |
|
39 | */ |
|
40 | protected $urlParameters = [ |
|
41 | 'name', |
|
42 | ]; |
|
43 | ||
44 | /** |
|
45 | * @return array |
|
46 | */ |
|
47 | public function rules() |
|
48 | { |
|
49 | return [ |
|
50 | 'name' => 'required|exists:permissions,name' |
|
51 | ]; |
|
52 | } |
|
53 | ||
54 | /** |
|
55 | * @return bool |
|
56 | */ |
|
57 | public function authorize() |
|
58 | { |
|
59 | return $this->hasAccess(); |
|
60 | } |
|
61 | } |
|
62 |
@@ 12-61 (lines=50) @@ | ||
9 | * |
|
10 | * @author Mahmoud Zalt <[email protected]> |
|
11 | */ |
|
12 | class GetRoleRequest extends Request |
|
13 | { |
|
14 | ||
15 | /** |
|
16 | * Define which Roles and/or Permissions has access to this request.. |
|
17 | * |
|
18 | * @var array |
|
19 | */ |
|
20 | protected $access = [ |
|
21 | 'roles' => 'admin', |
|
22 | 'permissions' => '', |
|
23 | ]; |
|
24 | ||
25 | /** |
|
26 | * Id's that needs decoding before applying the validation rules. |
|
27 | * |
|
28 | * @var array |
|
29 | */ |
|
30 | protected $decode = [ |
|
31 | ||
32 | ]; |
|
33 | ||
34 | /** |
|
35 | * Defining the URL parameters (`/stores/999/items`) allows applying |
|
36 | * validation rules on them and allows accessing them like request data. |
|
37 | * |
|
38 | * @var array |
|
39 | */ |
|
40 | protected $urlParameters = [ |
|
41 | 'name', |
|
42 | ]; |
|
43 | ||
44 | /** |
|
45 | * @return array |
|
46 | */ |
|
47 | public function rules() |
|
48 | { |
|
49 | return [ |
|
50 | 'name' => 'required|exists:roles,name' |
|
51 | ]; |
|
52 | } |
|
53 | ||
54 | /** |
|
55 | * @return bool |
|
56 | */ |
|
57 | public function authorize() |
|
58 | { |
|
59 | return $this->hasAccess(); |
|
60 | } |
|
61 | } |
|
62 |
@@ 12-61 (lines=50) @@ | ||
9 | * |
|
10 | * @author Mahmoud Zalt <[email protected]> |
|
11 | */ |
|
12 | class DeleteUserRequest extends Request |
|
13 | { |
|
14 | ||
15 | /** |
|
16 | * Define which Roles and/or Permissions has access to this request.. |
|
17 | * |
|
18 | * @var array |
|
19 | */ |
|
20 | protected $access = [ |
|
21 | 'permissions' => 'delete-users', |
|
22 | 'roles' => '', |
|
23 | ]; |
|
24 | ||
25 | /** |
|
26 | * Id's that needs decoding before applying the validation rules. |
|
27 | * |
|
28 | * @var array |
|
29 | */ |
|
30 | protected $decode = [ |
|
31 | 'id', |
|
32 | ]; |
|
33 | ||
34 | /** |
|
35 | * Defining the URL parameters (`/stores/999/items`) allows applying |
|
36 | * validation rules on them and allows accessing them like request data. |
|
37 | * |
|
38 | * @var array |
|
39 | */ |
|
40 | protected $urlParameters = [ |
|
41 | 'id', |
|
42 | ]; |
|
43 | ||
44 | /** |
|
45 | * @return array |
|
46 | */ |
|
47 | public function rules() |
|
48 | { |
|
49 | return [ |
|
50 | 'id' => 'required|exists:users,id', |
|
51 | ]; |
|
52 | } |
|
53 | ||
54 | /** |
|
55 | * @return bool |
|
56 | */ |
|
57 | public function authorize() |
|
58 | { |
|
59 | return $this->hasAccess(); |
|
60 | } |
|
61 | } |
|
62 |
@@ 12-61 (lines=50) @@ | ||
9 | * |
|
10 | * @author Mahmoud Zalt <[email protected]> |
|
11 | */ |
|
12 | class GetUserRequest extends Request |
|
13 | { |
|
14 | ||
15 | /** |
|
16 | * Define which Roles and/or Permissions has access to this request.. |
|
17 | * |
|
18 | * @var array |
|
19 | */ |
|
20 | protected $access = [ |
|
21 | 'permissions' => 'find-users', |
|
22 | 'roles' => '', |
|
23 | ]; |
|
24 | ||
25 | /** |
|
26 | * Id's that needs decoding before applying the validation rules. |
|
27 | * |
|
28 | * @var array |
|
29 | */ |
|
30 | protected $decode = [ |
|
31 | 'id', |
|
32 | ]; |
|
33 | ||
34 | /** |
|
35 | * Defining the URL parameters (`/stores/999/items`) allows applying |
|
36 | * validation rules on them and allows accessing them like request data. |
|
37 | * |
|
38 | * @var array |
|
39 | */ |
|
40 | protected $urlParameters = [ |
|
41 | 'id', |
|
42 | ]; |
|
43 | ||
44 | /** |
|
45 | * @return array |
|
46 | */ |
|
47 | public function rules() |
|
48 | { |
|
49 | return [ |
|
50 | 'id' => 'required|exists:users,id' |
|
51 | ]; |
|
52 | } |
|
53 | ||
54 | /** |
|
55 | * @return bool |
|
56 | */ |
|
57 | public function authorize() |
|
58 | { |
|
59 | return $this->hasAccess(); |
|
60 | } |
|
61 | } |
|
62 |