@@ -10,36 +10,36 @@ |
||
10 | 10 | |
11 | 11 | class SettingsController extends BaseApiController |
12 | 12 | { |
13 | - /** |
|
14 | - * The validations rules used by the base api controller |
|
15 | - * to check before add. |
|
16 | - * @var array |
|
17 | - */ |
|
18 | - protected $validationRules = [ |
|
19 | - 'id' => 'required|exists:settings,id', |
|
20 | - 'value' => 'required|string' |
|
21 | - ]; |
|
13 | + /** |
|
14 | + * The validations rules used by the base api controller |
|
15 | + * to check before add. |
|
16 | + * @var array |
|
17 | + */ |
|
18 | + protected $validationRules = [ |
|
19 | + 'id' => 'required|exists:settings,id', |
|
20 | + 'value' => 'required|string' |
|
21 | + ]; |
|
22 | 22 | |
23 | - /** |
|
24 | - * Init new object. |
|
25 | - * |
|
26 | - * @param SettingRepository $repo |
|
27 | - * @param CoreConfig $config |
|
28 | - * @return void |
|
29 | - */ |
|
30 | - public function __construct(SettingRepository $repo, CoreConfig $config) |
|
31 | - { |
|
32 | - parent::__construct($repo, $config, 'App\Modules\Core\Http\Resources\Setting'); |
|
33 | - } |
|
23 | + /** |
|
24 | + * Init new object. |
|
25 | + * |
|
26 | + * @param SettingRepository $repo |
|
27 | + * @param CoreConfig $config |
|
28 | + * @return void |
|
29 | + */ |
|
30 | + public function __construct(SettingRepository $repo, CoreConfig $config) |
|
31 | + { |
|
32 | + parent::__construct($repo, $config, 'App\Modules\Core\Http\Resources\Setting'); |
|
33 | + } |
|
34 | 34 | |
35 | - /** |
|
36 | - * Save list of settings. |
|
37 | - * |
|
38 | - * @param \Illuminate\Http\Request $request |
|
39 | - * @return \Illuminate\Http\Response |
|
40 | - */ |
|
41 | - public function saveMany(Request $request) |
|
42 | - { |
|
43 | - return new GeneralResource($this->repo->saveMany($request->all())); |
|
44 | - } |
|
35 | + /** |
|
36 | + * Save list of settings. |
|
37 | + * |
|
38 | + * @param \Illuminate\Http\Request $request |
|
39 | + * @return \Illuminate\Http\Response |
|
40 | + */ |
|
41 | + public function saveMany(Request $request) |
|
42 | + { |
|
43 | + return new GeneralResource($this->repo->saveMany($request->all())); |
|
44 | + } |
|
45 | 45 | } |
@@ -6,28 +6,28 @@ |
||
6 | 6 | |
7 | 7 | class OauthClient extends Client |
8 | 8 | { |
9 | - protected $dates = ['created_at', 'updated_at']; |
|
10 | - protected $fillable = ['name', 'redirect', 'user_id', 'personal_access_client', 'password_client', 'revoked']; |
|
11 | - public $searchable = ['name']; |
|
9 | + protected $dates = ['created_at', 'updated_at']; |
|
10 | + protected $fillable = ['name', 'redirect', 'user_id', 'personal_access_client', 'password_client', 'revoked']; |
|
11 | + public $searchable = ['name']; |
|
12 | 12 | |
13 | - public function getCreatedAtAttribute($value) |
|
14 | - { |
|
15 | - return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
16 | - } |
|
13 | + public function getCreatedAtAttribute($value) |
|
14 | + { |
|
15 | + return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
16 | + } |
|
17 | 17 | |
18 | - public function getUpdatedAtAttribute($value) |
|
19 | - { |
|
20 | - return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
21 | - } |
|
18 | + public function getUpdatedAtAttribute($value) |
|
19 | + { |
|
20 | + return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
21 | + } |
|
22 | 22 | |
23 | - public function user() |
|
24 | - { |
|
25 | - return $this->belongsTo('App\Modules\Acl\AclUser'); |
|
26 | - } |
|
23 | + public function user() |
|
24 | + { |
|
25 | + return $this->belongsTo('App\Modules\Acl\AclUser'); |
|
26 | + } |
|
27 | 27 | |
28 | - public static function boot() |
|
29 | - { |
|
30 | - parent::boot(); |
|
31 | - OauthClient::observe(\App::make('App\Modules\Acl\ModelObservers\OauthClientObserver')); |
|
32 | - } |
|
28 | + public static function boot() |
|
29 | + { |
|
30 | + parent::boot(); |
|
31 | + OauthClient::observe(\App::make('App\Modules\Acl\ModelObservers\OauthClientObserver')); |
|
32 | + } |
|
33 | 33 | } |
@@ -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 \Illuminate\Http\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 | - 'createdAt' => $this->created_at, |
|
23 | - 'updatedAt' => $this->updated_at, |
|
24 | - ]; |
|
25 | - } |
|
10 | + /** |
|
11 | + * Transform the resource into an array. |
|
12 | + * |
|
13 | + * @param \Illuminate\Http\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 | + 'createdAt' => $this->created_at, |
|
23 | + 'updatedAt' => $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 \Illuminate\Http\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 | - 'createdAt' => $this->created_at, |
|
27 | - 'updatedAt' => $this->updated_at, |
|
28 | - ]; |
|
29 | - } |
|
10 | + /** |
|
11 | + * Transform the resource into an array. |
|
12 | + * |
|
13 | + * @param \Illuminate\Http\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 | + 'createdAt' => $this->created_at, |
|
27 | + 'updatedAt' => $this->updated_at, |
|
28 | + ]; |
|
29 | + } |
|
30 | 30 | } |
@@ -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 \Illuminate\Http\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->time_zone, |
|
32 | - 'createdAt' => $this->created_at, |
|
33 | - 'updatedAt' => $this->updated_at, |
|
34 | - ]; |
|
35 | - } |
|
12 | + /** |
|
13 | + * Transform the resource into an array. |
|
14 | + * |
|
15 | + * @param \Illuminate\Http\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->time_zone, |
|
32 | + 'createdAt' => $this->created_at, |
|
33 | + 'updatedAt' => $this->updated_at, |
|
34 | + ]; |
|
35 | + } |
|
36 | 36 | } |
@@ -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 \Illuminate\Http\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 | - 'createdAt' => $this->created_at, |
|
25 | - 'updatedAt' => $this->updated_at, |
|
26 | - ]; |
|
27 | - } |
|
11 | + /** |
|
12 | + * Transform the resource into an array. |
|
13 | + * |
|
14 | + * @param \Illuminate\Http\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 | + 'createdAt' => $this->created_at, |
|
25 | + 'updatedAt' => $this->updated_at, |
|
26 | + ]; |
|
27 | + } |
|
28 | 28 | } |
@@ -9,40 +9,40 @@ |
||
9 | 9 | |
10 | 10 | class GroupsController extends BaseApiController |
11 | 11 | { |
12 | - /** |
|
13 | - * The validations rules used by the base api controller |
|
14 | - * to check before add. |
|
15 | - * @var array |
|
16 | - */ |
|
17 | - protected $validationRules = [ |
|
18 | - 'name' => 'required|string|max:100|unique:groups,name,{id}' |
|
19 | - ]; |
|
12 | + /** |
|
13 | + * The validations rules used by the base api controller |
|
14 | + * to check before add. |
|
15 | + * @var array |
|
16 | + */ |
|
17 | + protected $validationRules = [ |
|
18 | + 'name' => 'required|string|max:100|unique:groups,name,{id}' |
|
19 | + ]; |
|
20 | 20 | |
21 | - /** |
|
22 | - * Init new object. |
|
23 | - * |
|
24 | - * @param GroupRepository $repo |
|
25 | - * @param CoreConfig $config |
|
26 | - * @return void |
|
27 | - */ |
|
28 | - public function __construct(GroupRepository $repo, CoreConfig $config) |
|
29 | - { |
|
30 | - parent::__construct($repo, $config, 'App\Modules\Acl\Http\Resources\AclGroup'); |
|
31 | - } |
|
21 | + /** |
|
22 | + * Init new object. |
|
23 | + * |
|
24 | + * @param GroupRepository $repo |
|
25 | + * @param CoreConfig $config |
|
26 | + * @return void |
|
27 | + */ |
|
28 | + public function __construct(GroupRepository $repo, CoreConfig $config) |
|
29 | + { |
|
30 | + parent::__construct($repo, $config, 'App\Modules\Acl\Http\Resources\AclGroup'); |
|
31 | + } |
|
32 | 32 | |
33 | - /** |
|
34 | - * Handle an assign permissions to group request. |
|
35 | - * |
|
36 | - * @param \Illuminate\Http\Request $request |
|
37 | - * @return \Illuminate\Http\Response |
|
38 | - */ |
|
39 | - public function assignpermissions(Request $request) |
|
40 | - { |
|
41 | - $this->validate($request, [ |
|
42 | - 'permission_ids' => 'required|exists:permissions,id', |
|
43 | - 'group_id' => 'required|array|exists:groups,id' |
|
44 | - ]); |
|
33 | + /** |
|
34 | + * Handle an assign permissions to group request. |
|
35 | + * |
|
36 | + * @param \Illuminate\Http\Request $request |
|
37 | + * @return \Illuminate\Http\Response |
|
38 | + */ |
|
39 | + public function assignpermissions(Request $request) |
|
40 | + { |
|
41 | + $this->validate($request, [ |
|
42 | + 'permission_ids' => 'required|exists:permissions,id', |
|
43 | + 'group_id' => 'required|array|exists:groups,id' |
|
44 | + ]); |
|
45 | 45 | |
46 | - return new $this->modelResource($this->repo->assignPermissions($request->get('group_id'), $request->get('permission_ids'))); |
|
47 | - } |
|
46 | + return new $this->modelResource($this->repo->assignPermissions($request->get('group_id'), $request->get('permission_ids'))); |
|
47 | + } |
|
48 | 48 | } |
@@ -8,15 +8,15 @@ |
||
8 | 8 | |
9 | 9 | class PermissionsController 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 | } |
@@ -9,49 +9,49 @@ |
||
9 | 9 | |
10 | 10 | class OauthClientsController extends BaseApiController |
11 | 11 | { |
12 | - /** |
|
13 | - * The validations rules used by the base api controller |
|
14 | - * to check before add. |
|
15 | - * @var array |
|
16 | - */ |
|
17 | - protected $validationRules = [ |
|
18 | - 'name' => 'required|max:255', |
|
19 | - 'redirect' => 'required|url', |
|
20 | - 'user_id' => 'required|exists:users,id', |
|
21 | - 'revoked' => 'boolean' |
|
22 | - ]; |
|
12 | + /** |
|
13 | + * The validations rules used by the base api controller |
|
14 | + * to check before add. |
|
15 | + * @var array |
|
16 | + */ |
|
17 | + protected $validationRules = [ |
|
18 | + 'name' => 'required|max:255', |
|
19 | + 'redirect' => 'required|url', |
|
20 | + 'user_id' => 'required|exists:users,id', |
|
21 | + 'revoked' => 'boolean' |
|
22 | + ]; |
|
23 | 23 | |
24 | - /** |
|
25 | - * Init new object. |
|
26 | - * |
|
27 | - * @param OauthClientRepository $repo |
|
28 | - * @param CoreConfig $config |
|
29 | - * @return void |
|
30 | - */ |
|
31 | - public function __construct(OauthClientRepository $repo, CoreConfig $config) |
|
32 | - { |
|
33 | - parent::__construct($repo, $config, 'App\Modules\Acl\Http\Resources\OauthClient'); |
|
34 | - } |
|
24 | + /** |
|
25 | + * Init new object. |
|
26 | + * |
|
27 | + * @param OauthClientRepository $repo |
|
28 | + * @param CoreConfig $config |
|
29 | + * @return void |
|
30 | + */ |
|
31 | + public function __construct(OauthClientRepository $repo, CoreConfig $config) |
|
32 | + { |
|
33 | + parent::__construct($repo, $config, 'App\Modules\Acl\Http\Resources\OauthClient'); |
|
34 | + } |
|
35 | 35 | |
36 | - /** |
|
37 | - * Revoke the given client. |
|
38 | - * |
|
39 | - * @param integer $clientId Id of the client |
|
40 | - * @return \Illuminate\Http\Response |
|
41 | - */ |
|
42 | - public function revoke($clientId) |
|
43 | - { |
|
44 | - return new GeneralResource($this->repo->revoke($clientId)); |
|
45 | - } |
|
36 | + /** |
|
37 | + * Revoke the given client. |
|
38 | + * |
|
39 | + * @param integer $clientId Id of the client |
|
40 | + * @return \Illuminate\Http\Response |
|
41 | + */ |
|
42 | + public function revoke($clientId) |
|
43 | + { |
|
44 | + return new GeneralResource($this->repo->revoke($clientId)); |
|
45 | + } |
|
46 | 46 | |
47 | - /** |
|
48 | - * Un revoke the given client. |
|
49 | - * |
|
50 | - * @param integer $clientId Id of the client |
|
51 | - * @return \Illuminate\Http\Response |
|
52 | - */ |
|
53 | - public function unRevoke($clientId) |
|
54 | - { |
|
55 | - return new GeneralResource($this->repo->unRevoke($clientId)); |
|
56 | - } |
|
47 | + /** |
|
48 | + * Un revoke the given client. |
|
49 | + * |
|
50 | + * @param integer $clientId Id of the client |
|
51 | + * @return \Illuminate\Http\Response |
|
52 | + */ |
|
53 | + public function unRevoke($clientId) |
|
54 | + { |
|
55 | + return new GeneralResource($this->repo->unRevoke($clientId)); |
|
56 | + } |
|
57 | 57 | } |