@@ -7,20 +7,20 @@ |
||
7 | 7 | |
8 | 8 | class AclPermission extends JsonResource |
9 | 9 | { |
10 | - /** |
|
11 | - * Transform the resource into an array. |
|
12 | - * |
|
13 | - * @param Request $request |
|
14 | - * @return array |
|
15 | - */ |
|
16 | - public function toArray($request) |
|
17 | - { |
|
18 | - return [ |
|
19 | - 'id' => $this->id, |
|
20 | - 'name' => $this->name, |
|
21 | - 'groups' => GroupResource::collection($this->whenLoaded('groups')), |
|
22 | - 'created_at' => $this->created_at, |
|
23 | - 'updated_at' => $this->updated_at, |
|
24 | - ]; |
|
25 | - } |
|
10 | + /** |
|
11 | + * Transform the resource into an array. |
|
12 | + * |
|
13 | + * @param Request $request |
|
14 | + * @return array |
|
15 | + */ |
|
16 | + public function toArray($request) |
|
17 | + { |
|
18 | + return [ |
|
19 | + 'id' => $this->id, |
|
20 | + 'name' => $this->name, |
|
21 | + 'groups' => GroupResource::collection($this->whenLoaded('groups')), |
|
22 | + 'created_at' => $this->created_at, |
|
23 | + 'updated_at' => $this->updated_at, |
|
24 | + ]; |
|
25 | + } |
|
26 | 26 | } |
@@ -7,24 +7,24 @@ |
||
7 | 7 | |
8 | 8 | class OauthClient extends JsonResource |
9 | 9 | { |
10 | - /** |
|
11 | - * Transform the resource into an array. |
|
12 | - * |
|
13 | - * @param Request $request |
|
14 | - * @return array |
|
15 | - */ |
|
16 | - public function toArray($request) |
|
17 | - { |
|
18 | - return [ |
|
19 | - 'id' => $this->id, |
|
20 | - 'name' => $this->name, |
|
21 | - 'redirect' => $this->redirect, |
|
22 | - 'user' => new UserResource($this->whenLoaded('user')), |
|
23 | - 'personalAccessClient' => $this->personal_access_client, |
|
24 | - 'passwordClient' => $this->password_client, |
|
25 | - 'revoked' => $this->revoked, |
|
26 | - 'created_at' => $this->created_at, |
|
27 | - 'updated_at' => $this->updated_at, |
|
28 | - ]; |
|
29 | - } |
|
10 | + /** |
|
11 | + * Transform the resource into an array. |
|
12 | + * |
|
13 | + * @param Request $request |
|
14 | + * @return array |
|
15 | + */ |
|
16 | + public function toArray($request) |
|
17 | + { |
|
18 | + return [ |
|
19 | + 'id' => $this->id, |
|
20 | + 'name' => $this->name, |
|
21 | + 'redirect' => $this->redirect, |
|
22 | + 'user' => new UserResource($this->whenLoaded('user')), |
|
23 | + 'personalAccessClient' => $this->personal_access_client, |
|
24 | + 'passwordClient' => $this->password_client, |
|
25 | + 'revoked' => $this->revoked, |
|
26 | + 'created_at' => $this->created_at, |
|
27 | + 'updated_at' => $this->updated_at, |
|
28 | + ]; |
|
29 | + } |
|
30 | 30 | } |
@@ -8,21 +8,21 @@ |
||
8 | 8 | |
9 | 9 | class AclGroup extends JsonResource |
10 | 10 | { |
11 | - /** |
|
12 | - * Transform the resource into an array. |
|
13 | - * |
|
14 | - * @param Request $request |
|
15 | - * @return array |
|
16 | - */ |
|
17 | - public function toArray($request) |
|
18 | - { |
|
19 | - return [ |
|
20 | - 'id' => $this->id, |
|
21 | - 'name' => $this->name, |
|
22 | - 'users' => UserResource::collection($this->whenLoaded('users')), |
|
23 | - 'permissions' => PermissionResource::collection($this->whenLoaded('permissions')), |
|
24 | - 'created_at' => $this->created_at, |
|
25 | - 'updated_at' => $this->updated_at, |
|
26 | - ]; |
|
27 | - } |
|
11 | + /** |
|
12 | + * Transform the resource into an array. |
|
13 | + * |
|
14 | + * @param Request $request |
|
15 | + * @return array |
|
16 | + */ |
|
17 | + public function toArray($request) |
|
18 | + { |
|
19 | + return [ |
|
20 | + 'id' => $this->id, |
|
21 | + 'name' => $this->name, |
|
22 | + 'users' => UserResource::collection($this->whenLoaded('users')), |
|
23 | + 'permissions' => PermissionResource::collection($this->whenLoaded('permissions')), |
|
24 | + 'created_at' => $this->created_at, |
|
25 | + 'updated_at' => $this->updated_at, |
|
26 | + ]; |
|
27 | + } |
|
28 | 28 | } |
@@ -9,28 +9,28 @@ |
||
9 | 9 | |
10 | 10 | class AclUser extends JsonResource |
11 | 11 | { |
12 | - /** |
|
13 | - * Transform the resource into an array. |
|
14 | - * |
|
15 | - * @param Request $request |
|
16 | - * @return array |
|
17 | - */ |
|
18 | - public function toArray($request) |
|
19 | - { |
|
20 | - return [ |
|
21 | - 'id' => $this->id, |
|
22 | - 'name' => $this->name, |
|
23 | - 'email' => $this->email, |
|
24 | - 'profilePicture' => $this->profile_picture, |
|
25 | - 'notifications' => NotificationResource::collection($this->whenLoaded('notifications')), |
|
26 | - 'readNotifications' => NotificationResource::collection($this->whenLoaded('readNotifications')), |
|
27 | - 'unreadNotifications' => NotificationResource::collection($this->whenLoaded('unreadNotifications')), |
|
28 | - 'groups' => AclGroupResource::collection($this->whenLoaded('groups')), |
|
29 | - 'oauthClients' => OauthClientResource::collection($this->whenLoaded('oauthClients')), |
|
30 | - 'locale' => $this->locale, |
|
31 | - 'timezone' => $this->timezone, |
|
32 | - 'created_at' => $this->created_at, |
|
33 | - 'updated_at' => $this->updated_at, |
|
34 | - ]; |
|
35 | - } |
|
12 | + /** |
|
13 | + * Transform the resource into an array. |
|
14 | + * |
|
15 | + * @param Request $request |
|
16 | + * @return array |
|
17 | + */ |
|
18 | + public function toArray($request) |
|
19 | + { |
|
20 | + return [ |
|
21 | + 'id' => $this->id, |
|
22 | + 'name' => $this->name, |
|
23 | + 'email' => $this->email, |
|
24 | + 'profilePicture' => $this->profile_picture, |
|
25 | + 'notifications' => NotificationResource::collection($this->whenLoaded('notifications')), |
|
26 | + 'readNotifications' => NotificationResource::collection($this->whenLoaded('readNotifications')), |
|
27 | + 'unreadNotifications' => NotificationResource::collection($this->whenLoaded('unreadNotifications')), |
|
28 | + 'groups' => AclGroupResource::collection($this->whenLoaded('groups')), |
|
29 | + 'oauthClients' => OauthClientResource::collection($this->whenLoaded('oauthClients')), |
|
30 | + 'locale' => $this->locale, |
|
31 | + 'timezone' => $this->timezone, |
|
32 | + 'created_at' => $this->created_at, |
|
33 | + 'updated_at' => $this->updated_at, |
|
34 | + ]; |
|
35 | + } |
|
36 | 36 | } |
@@ -11,48 +11,48 @@ |
||
11 | 11 | |
12 | 12 | class GroupController extends BaseApiController |
13 | 13 | { |
14 | - /** |
|
15 | - * Init new object. |
|
16 | - * |
|
17 | - * @param GroupRepository $repo |
|
18 | - * @param CoreConfig $config |
|
19 | - * @return void |
|
20 | - */ |
|
21 | - public function __construct(GroupRepository $repo, CoreConfig $config) |
|
22 | - { |
|
23 | - parent::__construct($repo, $config, 'App\Modules\Acl\Http\Resources\AclGroup'); |
|
24 | - } |
|
14 | + /** |
|
15 | + * Init new object. |
|
16 | + * |
|
17 | + * @param GroupRepository $repo |
|
18 | + * @param CoreConfig $config |
|
19 | + * @return void |
|
20 | + */ |
|
21 | + public function __construct(GroupRepository $repo, CoreConfig $config) |
|
22 | + { |
|
23 | + parent::__construct($repo, $config, 'App\Modules\Acl\Http\Resources\AclGroup'); |
|
24 | + } |
|
25 | 25 | |
26 | - /** |
|
27 | - * Insert the given model to storage. |
|
28 | - * |
|
29 | - * @param InsertGroup $request |
|
30 | - * @return \Illuminate\Http\Response |
|
31 | - */ |
|
32 | - public function insert(InsertGroup $request) |
|
33 | - { |
|
34 | - return new $this->modelResource($this->repo->save($request->all())); |
|
35 | - } |
|
26 | + /** |
|
27 | + * Insert the given model to storage. |
|
28 | + * |
|
29 | + * @param InsertGroup $request |
|
30 | + * @return \Illuminate\Http\Response |
|
31 | + */ |
|
32 | + public function insert(InsertGroup $request) |
|
33 | + { |
|
34 | + return new $this->modelResource($this->repo->save($request->all())); |
|
35 | + } |
|
36 | 36 | |
37 | - /** |
|
38 | - * Update the given model to storage. |
|
39 | - * |
|
40 | - * @param UpdateGroup $request |
|
41 | - * @return \Illuminate\Http\Response |
|
42 | - */ |
|
43 | - public function update(UpdateGroup $request) |
|
44 | - { |
|
45 | - return new $this->modelResource($this->repo->save($request->all())); |
|
46 | - } |
|
37 | + /** |
|
38 | + * Update the given model to storage. |
|
39 | + * |
|
40 | + * @param UpdateGroup $request |
|
41 | + * @return \Illuminate\Http\Response |
|
42 | + */ |
|
43 | + public function update(UpdateGroup $request) |
|
44 | + { |
|
45 | + return new $this->modelResource($this->repo->save($request->all())); |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * Handle an assign permissions to group request. |
|
50 | - * |
|
51 | - * @param AssignPermissions $request |
|
52 | - * @return \Illuminate\Http\Response |
|
53 | - */ |
|
54 | - public function assignPermissions(AssignPermissions $request) |
|
55 | - { |
|
56 | - return new $this->modelResource($this->repo->assignPermissions($request->get('group_id'), $request->get('permission_ids'))); |
|
57 | - } |
|
48 | + /** |
|
49 | + * Handle an assign permissions to group request. |
|
50 | + * |
|
51 | + * @param AssignPermissions $request |
|
52 | + * @return \Illuminate\Http\Response |
|
53 | + */ |
|
54 | + public function assignPermissions(AssignPermissions $request) |
|
55 | + { |
|
56 | + return new $this->modelResource($this->repo->assignPermissions($request->get('group_id'), $request->get('permission_ids'))); |
|
57 | + } |
|
58 | 58 | } |
@@ -8,15 +8,15 @@ |
||
8 | 8 | |
9 | 9 | class PermissionController extends BaseApiController |
10 | 10 | { |
11 | - /** |
|
12 | - * Init new object. |
|
13 | - * |
|
14 | - * @param PermissionRepository $repo |
|
15 | - * @param CoreConfig $config |
|
16 | - * @return void |
|
17 | - */ |
|
18 | - public function __construct(PermissionRepository $repo, CoreConfig $config) |
|
19 | - { |
|
20 | - parent::__construct($repo, $config, 'App\Modules\Acl\Http\Resources\AclPermission'); |
|
21 | - } |
|
11 | + /** |
|
12 | + * Init new object. |
|
13 | + * |
|
14 | + * @param PermissionRepository $repo |
|
15 | + * @param CoreConfig $config |
|
16 | + * @return void |
|
17 | + */ |
|
18 | + public function __construct(PermissionRepository $repo, CoreConfig $config) |
|
19 | + { |
|
20 | + parent::__construct($repo, $config, 'App\Modules\Acl\Http\Resources\AclPermission'); |
|
21 | + } |
|
22 | 22 | } |
@@ -11,59 +11,59 @@ |
||
11 | 11 | |
12 | 12 | class OauthClientController extends BaseApiController |
13 | 13 | { |
14 | - /** |
|
15 | - * Init new object. |
|
16 | - * |
|
17 | - * @param OauthClientRepository $repo |
|
18 | - * @param CoreConfig $config |
|
19 | - * @return void |
|
20 | - */ |
|
21 | - public function __construct(OauthClientRepository $repo, CoreConfig $config) |
|
22 | - { |
|
23 | - parent::__construct($repo, $config, 'App\Modules\Acl\Http\Resources\OauthClient'); |
|
24 | - } |
|
14 | + /** |
|
15 | + * Init new object. |
|
16 | + * |
|
17 | + * @param OauthClientRepository $repo |
|
18 | + * @param CoreConfig $config |
|
19 | + * @return void |
|
20 | + */ |
|
21 | + public function __construct(OauthClientRepository $repo, CoreConfig $config) |
|
22 | + { |
|
23 | + parent::__construct($repo, $config, 'App\Modules\Acl\Http\Resources\OauthClient'); |
|
24 | + } |
|
25 | 25 | |
26 | - /** |
|
27 | - * Insert the given model to storage. |
|
28 | - * |
|
29 | - * @param InsertOauthClient $request |
|
30 | - * @return \Illuminate\Http\Response |
|
31 | - */ |
|
32 | - public function insert(InsertOauthClient $request) |
|
33 | - { |
|
34 | - return new $this->modelResource($this->repo->save($request->all())); |
|
35 | - } |
|
26 | + /** |
|
27 | + * Insert the given model to storage. |
|
28 | + * |
|
29 | + * @param InsertOauthClient $request |
|
30 | + * @return \Illuminate\Http\Response |
|
31 | + */ |
|
32 | + public function insert(InsertOauthClient $request) |
|
33 | + { |
|
34 | + return new $this->modelResource($this->repo->save($request->all())); |
|
35 | + } |
|
36 | 36 | |
37 | - /** |
|
38 | - * Update the given model to storage. |
|
39 | - * |
|
40 | - * @param UpdateOauthClient $request |
|
41 | - * @return \Illuminate\Http\Response |
|
42 | - */ |
|
43 | - public function update(UpdateOauthClient $request) |
|
44 | - { |
|
45 | - return new $this->modelResource($this->repo->save($request->all())); |
|
46 | - } |
|
37 | + /** |
|
38 | + * Update the given model to storage. |
|
39 | + * |
|
40 | + * @param UpdateOauthClient $request |
|
41 | + * @return \Illuminate\Http\Response |
|
42 | + */ |
|
43 | + public function update(UpdateOauthClient $request) |
|
44 | + { |
|
45 | + return new $this->modelResource($this->repo->save($request->all())); |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * Revoke the given client. |
|
50 | - * |
|
51 | - * @param integer $clientId Id of the client |
|
52 | - * @return \Illuminate\Http\Response |
|
53 | - */ |
|
54 | - public function revoke($clientId) |
|
55 | - { |
|
56 | - return new GeneralResource($this->repo->revoke($clientId)); |
|
57 | - } |
|
48 | + /** |
|
49 | + * Revoke the given client. |
|
50 | + * |
|
51 | + * @param integer $clientId Id of the client |
|
52 | + * @return \Illuminate\Http\Response |
|
53 | + */ |
|
54 | + public function revoke($clientId) |
|
55 | + { |
|
56 | + return new GeneralResource($this->repo->revoke($clientId)); |
|
57 | + } |
|
58 | 58 | |
59 | - /** |
|
60 | - * Un revoke the given client. |
|
61 | - * |
|
62 | - * @param integer $clientId Id of the client |
|
63 | - * @return \Illuminate\Http\Response |
|
64 | - */ |
|
65 | - public function unRevoke($clientId) |
|
66 | - { |
|
67 | - return new GeneralResource($this->repo->unRevoke($clientId)); |
|
68 | - } |
|
59 | + /** |
|
60 | + * Un revoke the given client. |
|
61 | + * |
|
62 | + * @param integer $clientId Id of the client |
|
63 | + * @return \Illuminate\Http\Response |
|
64 | + */ |
|
65 | + public function unRevoke($clientId) |
|
66 | + { |
|
67 | + return new GeneralResource($this->repo->unRevoke($clientId)); |
|
68 | + } |
|
69 | 69 | } |
@@ -25,239 +25,239 @@ |
||
25 | 25 | |
26 | 26 | class UserController extends BaseApiController |
27 | 27 | { |
28 | - /** |
|
29 | - * List of all route actions that the base api controller |
|
30 | - * will skip permissions check for them. |
|
31 | - * @var array |
|
32 | - */ |
|
33 | - protected $skipPermissionCheck = ['account', 'logout', 'changePassword', 'saveProfile', 'account']; |
|
28 | + /** |
|
29 | + * List of all route actions that the base api controller |
|
30 | + * will skip permissions check for them. |
|
31 | + * @var array |
|
32 | + */ |
|
33 | + protected $skipPermissionCheck = ['account', 'logout', 'changePassword', 'saveProfile', 'account']; |
|
34 | 34 | |
35 | - /** |
|
36 | - * List of all route actions that the base api controller |
|
37 | - * will skip login check for them. |
|
38 | - * @var array |
|
39 | - */ |
|
40 | - protected $skipLoginCheck = ['login', 'loginSocial', 'register', 'sendReset', 'resetPassword', 'refreshToken', 'confirmEmail', 'resendEmailConfirmation']; |
|
35 | + /** |
|
36 | + * List of all route actions that the base api controller |
|
37 | + * will skip login check for them. |
|
38 | + * @var array |
|
39 | + */ |
|
40 | + protected $skipLoginCheck = ['login', 'loginSocial', 'register', 'sendReset', 'resetPassword', 'refreshToken', 'confirmEmail', 'resendEmailConfirmation']; |
|
41 | 41 | |
42 | - /** |
|
43 | - * The loginProxy implementation. |
|
44 | - * |
|
45 | - * @var App\Modules\Acl\Proxy\LoginProxy |
|
46 | - */ |
|
47 | - protected $loginProxy; |
|
42 | + /** |
|
43 | + * The loginProxy implementation. |
|
44 | + * |
|
45 | + * @var App\Modules\Acl\Proxy\LoginProxy |
|
46 | + */ |
|
47 | + protected $loginProxy; |
|
48 | 48 | |
49 | - /** |
|
50 | - * Init new object. |
|
51 | - * |
|
52 | - * @param LoginProxy $loginProxy |
|
53 | - * @param UserRepository $repo |
|
54 | - * @param CoreConfig $config |
|
55 | - * @return void |
|
56 | - */ |
|
57 | - public function __construct(LoginProxy $loginProxy, UserRepository $repo, CoreConfig $config) |
|
58 | - { |
|
59 | - $this->loginProxy = $loginProxy; |
|
60 | - parent::__construct($repo, $config, 'App\Modules\Acl\Http\Resources\AclUser'); |
|
61 | - } |
|
49 | + /** |
|
50 | + * Init new object. |
|
51 | + * |
|
52 | + * @param LoginProxy $loginProxy |
|
53 | + * @param UserRepository $repo |
|
54 | + * @param CoreConfig $config |
|
55 | + * @return void |
|
56 | + */ |
|
57 | + public function __construct(LoginProxy $loginProxy, UserRepository $repo, CoreConfig $config) |
|
58 | + { |
|
59 | + $this->loginProxy = $loginProxy; |
|
60 | + parent::__construct($repo, $config, 'App\Modules\Acl\Http\Resources\AclUser'); |
|
61 | + } |
|
62 | 62 | |
63 | - /** |
|
64 | - * Insert the given model to storage. |
|
65 | - * |
|
66 | - * @param InsertUser $request |
|
67 | - * @return \Illuminate\Http\Response |
|
68 | - */ |
|
69 | - public function insert(InsertUser $request) |
|
70 | - { |
|
71 | - return new $this->modelResource($this->repo->save($request->all())); |
|
72 | - } |
|
63 | + /** |
|
64 | + * Insert the given model to storage. |
|
65 | + * |
|
66 | + * @param InsertUser $request |
|
67 | + * @return \Illuminate\Http\Response |
|
68 | + */ |
|
69 | + public function insert(InsertUser $request) |
|
70 | + { |
|
71 | + return new $this->modelResource($this->repo->save($request->all())); |
|
72 | + } |
|
73 | 73 | |
74 | - /** |
|
75 | - * Update the given model to storage. |
|
76 | - * |
|
77 | - * @param UpdateUser $request |
|
78 | - * @return \Illuminate\Http\Response |
|
79 | - */ |
|
80 | - public function update(UpdateUser $request) |
|
81 | - { |
|
82 | - return new $this->modelResource($this->repo->save($request->all())); |
|
83 | - } |
|
74 | + /** |
|
75 | + * Update the given model to storage. |
|
76 | + * |
|
77 | + * @param UpdateUser $request |
|
78 | + * @return \Illuminate\Http\Response |
|
79 | + */ |
|
80 | + public function update(UpdateUser $request) |
|
81 | + { |
|
82 | + return new $this->modelResource($this->repo->save($request->all())); |
|
83 | + } |
|
84 | 84 | |
85 | - /** |
|
86 | - * Return the logged in user account. |
|
87 | - * |
|
88 | - * @return \Illuminate\Http\Response |
|
89 | - */ |
|
90 | - public function account() |
|
91 | - { |
|
92 | - return new $this->modelResource($this->repo->account($this->relations)); |
|
93 | - } |
|
85 | + /** |
|
86 | + * Return the logged in user account. |
|
87 | + * |
|
88 | + * @return \Illuminate\Http\Response |
|
89 | + */ |
|
90 | + public function account() |
|
91 | + { |
|
92 | + return new $this->modelResource($this->repo->account($this->relations)); |
|
93 | + } |
|
94 | 94 | |
95 | - /** |
|
96 | - * Block the user. |
|
97 | - * |
|
98 | - * @param integer $id Id of the user. |
|
99 | - * @return \Illuminate\Http\Response |
|
100 | - */ |
|
101 | - public function block($id) |
|
102 | - { |
|
103 | - return new $this->modelResource($this->repo->block($id)); |
|
104 | - } |
|
95 | + /** |
|
96 | + * Block the user. |
|
97 | + * |
|
98 | + * @param integer $id Id of the user. |
|
99 | + * @return \Illuminate\Http\Response |
|
100 | + */ |
|
101 | + public function block($id) |
|
102 | + { |
|
103 | + return new $this->modelResource($this->repo->block($id)); |
|
104 | + } |
|
105 | 105 | |
106 | - /** |
|
107 | - * Unblock the user. |
|
108 | - * |
|
109 | - * @param integer $id Id of the user. |
|
110 | - * @return \Illuminate\Http\Response |
|
111 | - */ |
|
112 | - public function unblock($id) |
|
113 | - { |
|
114 | - return new $this->modelResource($this->repo->unblock($id)); |
|
115 | - } |
|
106 | + /** |
|
107 | + * Unblock the user. |
|
108 | + * |
|
109 | + * @param integer $id Id of the user. |
|
110 | + * @return \Illuminate\Http\Response |
|
111 | + */ |
|
112 | + public function unblock($id) |
|
113 | + { |
|
114 | + return new $this->modelResource($this->repo->unblock($id)); |
|
115 | + } |
|
116 | 116 | |
117 | - /** |
|
118 | - * Logout the user. |
|
119 | - * |
|
120 | - * @return \Illuminate\Http\Response |
|
121 | - */ |
|
122 | - public function logout() |
|
123 | - { |
|
124 | - return new GeneralResource($this->loginProxy->logout()); |
|
125 | - } |
|
117 | + /** |
|
118 | + * Logout the user. |
|
119 | + * |
|
120 | + * @return \Illuminate\Http\Response |
|
121 | + */ |
|
122 | + public function logout() |
|
123 | + { |
|
124 | + return new GeneralResource($this->loginProxy->logout()); |
|
125 | + } |
|
126 | 126 | |
127 | - /** |
|
128 | - * Handle a registration request. |
|
129 | - * |
|
130 | - * @param Register $request |
|
131 | - * @return \Illuminate\Http\Response |
|
132 | - */ |
|
133 | - public function register(Register $request) |
|
134 | - { |
|
135 | - return new $this->modelResource($this->repo->register($request->only('name', 'email', 'password'))); |
|
136 | - } |
|
127 | + /** |
|
128 | + * Handle a registration request. |
|
129 | + * |
|
130 | + * @param Register $request |
|
131 | + * @return \Illuminate\Http\Response |
|
132 | + */ |
|
133 | + public function register(Register $request) |
|
134 | + { |
|
135 | + return new $this->modelResource($this->repo->register($request->only('name', 'email', 'password'))); |
|
136 | + } |
|
137 | 137 | |
138 | - /** |
|
139 | - * Handle a login request to the application. |
|
140 | - * |
|
141 | - * @param Login $request |
|
142 | - * @return \Illuminate\Http\Response |
|
143 | - */ |
|
144 | - public function login(Login $request) |
|
145 | - { |
|
146 | - $result = $this->loginProxy->login($request->only('email', 'password'), $request->get('admin')); |
|
138 | + /** |
|
139 | + * Handle a login request to the application. |
|
140 | + * |
|
141 | + * @param Login $request |
|
142 | + * @return \Illuminate\Http\Response |
|
143 | + */ |
|
144 | + public function login(Login $request) |
|
145 | + { |
|
146 | + $result = $this->loginProxy->login($request->only('email', 'password'), $request->get('admin')); |
|
147 | 147 | |
148 | - return (new $this->modelResource($result['user']))->additional(['meta' => $result['tokens']]); |
|
149 | - } |
|
148 | + return (new $this->modelResource($result['user']))->additional(['meta' => $result['tokens']]); |
|
149 | + } |
|
150 | 150 | |
151 | - /** |
|
152 | - * Handle a social login request of the none admin to the application. |
|
153 | - * |
|
154 | - * @param LoginSocial $request |
|
155 | - * @return \Illuminate\Http\Response |
|
156 | - */ |
|
157 | - public function loginSocial(LoginSocial $request) |
|
158 | - { |
|
159 | - $result = $this->repo->loginSocial($request->get('auth_code'), $request->get('access_token'), $request->get('type')); |
|
151 | + /** |
|
152 | + * Handle a social login request of the none admin to the application. |
|
153 | + * |
|
154 | + * @param LoginSocial $request |
|
155 | + * @return \Illuminate\Http\Response |
|
156 | + */ |
|
157 | + public function loginSocial(LoginSocial $request) |
|
158 | + { |
|
159 | + $result = $this->repo->loginSocial($request->get('auth_code'), $request->get('access_token'), $request->get('type')); |
|
160 | 160 | |
161 | - return (new $this->modelResource($result['user']))->additional(['meta' => $result['tokens']]); |
|
162 | - } |
|
161 | + return (new $this->modelResource($result['user']))->additional(['meta' => $result['tokens']]); |
|
162 | + } |
|
163 | 163 | |
164 | - /** |
|
165 | - * Assign the given groups to the given user. |
|
166 | - * |
|
167 | - * @param AssignGroups $request |
|
168 | - * @return \Illuminate\Http\Response |
|
169 | - */ |
|
170 | - public function assignGroups(AssignGroups $request) |
|
171 | - { |
|
172 | - return new $this->modelResource($this->repo->assignGroups($request->get('user_id'), $request->get('group_ids'))); |
|
173 | - } |
|
164 | + /** |
|
165 | + * Assign the given groups to the given user. |
|
166 | + * |
|
167 | + * @param AssignGroups $request |
|
168 | + * @return \Illuminate\Http\Response |
|
169 | + */ |
|
170 | + public function assignGroups(AssignGroups $request) |
|
171 | + { |
|
172 | + return new $this->modelResource($this->repo->assignGroups($request->get('user_id'), $request->get('group_ids'))); |
|
173 | + } |
|
174 | 174 | |
175 | - /** |
|
176 | - * Send a reset link to the given user. |
|
177 | - * |
|
178 | - * @param SendReset $request |
|
179 | - * @return \Illuminate\Http\Response |
|
180 | - */ |
|
181 | - public function sendReset(SendReset $request) |
|
182 | - { |
|
183 | - return new GeneralResource($this->repo->sendReset($request->get('email'))); |
|
184 | - } |
|
175 | + /** |
|
176 | + * Send a reset link to the given user. |
|
177 | + * |
|
178 | + * @param SendReset $request |
|
179 | + * @return \Illuminate\Http\Response |
|
180 | + */ |
|
181 | + public function sendReset(SendReset $request) |
|
182 | + { |
|
183 | + return new GeneralResource($this->repo->sendReset($request->get('email'))); |
|
184 | + } |
|
185 | 185 | |
186 | - /** |
|
187 | - * Reset the given user's password. |
|
188 | - * |
|
189 | - * @param ResetPassword $request |
|
190 | - * @return \Illuminate\Http\Response |
|
191 | - */ |
|
192 | - public function resetPassword(ResetPassword $request) |
|
193 | - { |
|
194 | - return new GeneralResource($this->repo->resetPassword($request->only('email', 'password', 'password_confirmation', 'token'))); |
|
195 | - } |
|
186 | + /** |
|
187 | + * Reset the given user's password. |
|
188 | + * |
|
189 | + * @param ResetPassword $request |
|
190 | + * @return \Illuminate\Http\Response |
|
191 | + */ |
|
192 | + public function resetPassword(ResetPassword $request) |
|
193 | + { |
|
194 | + return new GeneralResource($this->repo->resetPassword($request->only('email', 'password', 'password_confirmation', 'token'))); |
|
195 | + } |
|
196 | 196 | |
197 | - /** |
|
198 | - * Change the logged in user password. |
|
199 | - * |
|
200 | - * @param ChangePassword $request |
|
201 | - * @return \Illuminate\Http\Response |
|
202 | - */ |
|
203 | - public function changePassword(ChangePassword $request) |
|
204 | - { |
|
205 | - return new GeneralResource($this->repo->changePassword($request->only('old_password', 'password', 'password_confirmation'))); |
|
206 | - } |
|
197 | + /** |
|
198 | + * Change the logged in user password. |
|
199 | + * |
|
200 | + * @param ChangePassword $request |
|
201 | + * @return \Illuminate\Http\Response |
|
202 | + */ |
|
203 | + public function changePassword(ChangePassword $request) |
|
204 | + { |
|
205 | + return new GeneralResource($this->repo->changePassword($request->only('old_password', 'password', 'password_confirmation'))); |
|
206 | + } |
|
207 | 207 | |
208 | - /** |
|
209 | - * Confirm email using the confirmation code. |
|
210 | - * |
|
211 | - * @param ConfirmEmail $request |
|
212 | - * @return \Illuminate\Http\Response |
|
213 | - */ |
|
214 | - public function confirmEmail(ConfirmEmail $request) |
|
215 | - { |
|
216 | - return new GeneralResource($this->repo->confirmEmail($request->only('confirmation_code'))); |
|
217 | - } |
|
208 | + /** |
|
209 | + * Confirm email using the confirmation code. |
|
210 | + * |
|
211 | + * @param ConfirmEmail $request |
|
212 | + * @return \Illuminate\Http\Response |
|
213 | + */ |
|
214 | + public function confirmEmail(ConfirmEmail $request) |
|
215 | + { |
|
216 | + return new GeneralResource($this->repo->confirmEmail($request->only('confirmation_code'))); |
|
217 | + } |
|
218 | 218 | |
219 | - /** |
|
220 | - * Resend the email confirmation mail. |
|
221 | - * |
|
222 | - * @param ResendEmailConfirmation $request |
|
223 | - * @return \Illuminate\Http\Response |
|
224 | - */ |
|
225 | - public function resendEmailConfirmation(ResendEmailConfirmation $request) |
|
226 | - { |
|
227 | - return new GeneralResource($this->repo->sendConfirmationEmail($request->get('email'))); |
|
228 | - } |
|
219 | + /** |
|
220 | + * Resend the email confirmation mail. |
|
221 | + * |
|
222 | + * @param ResendEmailConfirmation $request |
|
223 | + * @return \Illuminate\Http\Response |
|
224 | + */ |
|
225 | + public function resendEmailConfirmation(ResendEmailConfirmation $request) |
|
226 | + { |
|
227 | + return new GeneralResource($this->repo->sendConfirmationEmail($request->get('email'))); |
|
228 | + } |
|
229 | 229 | |
230 | - /** |
|
231 | - * Refresh the expired login token. |
|
232 | - * |
|
233 | - * @param RefreshToken $request |
|
234 | - * @return \Illuminate\Http\Response |
|
235 | - */ |
|
236 | - public function refreshToken(RefreshToken $request) |
|
237 | - { |
|
238 | - return new GeneralResource($this->loginProxy->refreshToken($request->get('refresh_token'))); |
|
239 | - } |
|
230 | + /** |
|
231 | + * Refresh the expired login token. |
|
232 | + * |
|
233 | + * @param RefreshToken $request |
|
234 | + * @return \Illuminate\Http\Response |
|
235 | + */ |
|
236 | + public function refreshToken(RefreshToken $request) |
|
237 | + { |
|
238 | + return new GeneralResource($this->loginProxy->refreshToken($request->get('refresh_token'))); |
|
239 | + } |
|
240 | 240 | |
241 | - /** |
|
242 | - * Paginate all users with in the given group. |
|
243 | - * |
|
244 | - * @param Request $request |
|
245 | - * @param string $groupName The name of the requested group. |
|
246 | - * @return \Illuminate\Http\Response |
|
247 | - */ |
|
248 | - public function group(Request $request, $groupName) |
|
249 | - { |
|
250 | - return $this->modelResource::collection($this->repo->group($request->all(), $groupName, $this->relations, $request->query('perPage'), $request->query('sortBy'), $request->query('desc'))); |
|
251 | - } |
|
241 | + /** |
|
242 | + * Paginate all users with in the given group. |
|
243 | + * |
|
244 | + * @param Request $request |
|
245 | + * @param string $groupName The name of the requested group. |
|
246 | + * @return \Illuminate\Http\Response |
|
247 | + */ |
|
248 | + public function group(Request $request, $groupName) |
|
249 | + { |
|
250 | + return $this->modelResource::collection($this->repo->group($request->all(), $groupName, $this->relations, $request->query('perPage'), $request->query('sortBy'), $request->query('desc'))); |
|
251 | + } |
|
252 | 252 | |
253 | - /** |
|
254 | - * Save the given data to the logged in user. |
|
255 | - * |
|
256 | - * @param SaveProfile $request |
|
257 | - * @return \Illuminate\Http\Response |
|
258 | - */ |
|
259 | - public function saveProfile(SaveProfile $request) |
|
260 | - { |
|
261 | - return new $this->modelResource($this->repo->saveProfile($request->only('name', 'email', 'profile_picture'))); |
|
262 | - } |
|
253 | + /** |
|
254 | + * Save the given data to the logged in user. |
|
255 | + * |
|
256 | + * @param SaveProfile $request |
|
257 | + * @return \Illuminate\Http\Response |
|
258 | + */ |
|
259 | + public function saveProfile(SaveProfile $request) |
|
260 | + { |
|
261 | + return new $this->modelResource($this->repo->saveProfile($request->only('name', 'email', 'profile_picture'))); |
|
262 | + } |
|
263 | 263 | } |
@@ -6,25 +6,25 @@ |
||
6 | 6 | |
7 | 7 | class ResendEmailConfirmation extends FormRequest |
8 | 8 | { |
9 | - /** |
|
10 | - * Determine if the user is authorized to make this request. |
|
11 | - * |
|
12 | - * @return bool |
|
13 | - */ |
|
14 | - public function authorize() |
|
15 | - { |
|
16 | - return true; |
|
17 | - } |
|
9 | + /** |
|
10 | + * Determine if the user is authorized to make this request. |
|
11 | + * |
|
12 | + * @return bool |
|
13 | + */ |
|
14 | + public function authorize() |
|
15 | + { |
|
16 | + return true; |
|
17 | + } |
|
18 | 18 | |
19 | - /** |
|
20 | - * Get the validation rules that apply to the request. |
|
21 | - * |
|
22 | - * @return array |
|
23 | - */ |
|
24 | - public function rules() |
|
25 | - { |
|
26 | - return [ |
|
27 | - 'email' => 'required|exists:users,email' |
|
28 | - ]; |
|
29 | - } |
|
19 | + /** |
|
20 | + * Get the validation rules that apply to the request. |
|
21 | + * |
|
22 | + * @return array |
|
23 | + */ |
|
24 | + public function rules() |
|
25 | + { |
|
26 | + return [ |
|
27 | + 'email' => 'required|exists:users,email' |
|
28 | + ]; |
|
29 | + } |
|
30 | 30 | } |