@@ -1,9 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | $factory->define(App\Modules\Roles\Role::class, function (Faker\Generator $faker) { |
4 | - return [ |
|
5 | - 'name' => $faker->unique->word(), |
|
6 | - 'created_at' => $faker->dateTimeBetween('-1 years', 'now'), |
|
7 | - 'updated_at' => $faker->dateTimeBetween('-1 years', 'now') |
|
8 | - ]; |
|
4 | + return [ |
|
5 | + 'name' => $faker->unique->word(), |
|
6 | + 'created_at' => $faker->dateTimeBetween('-1 years', 'now'), |
|
7 | + 'updated_at' => $faker->dateTimeBetween('-1 years', 'now') |
|
8 | + ]; |
|
9 | 9 | }); |
@@ -6,26 +6,26 @@ |
||
6 | 6 | |
7 | 7 | class AssignPermissions 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 | - 'permission_ids' => 'required|exists:permissions,id', |
|
28 | - 'role_id' => 'required|array|exists:roles,id' |
|
29 | - ]; |
|
30 | - } |
|
19 | + /** |
|
20 | + * Get the validation rules that apply to the request. |
|
21 | + * |
|
22 | + * @return array |
|
23 | + */ |
|
24 | + public function rules() |
|
25 | + { |
|
26 | + return [ |
|
27 | + 'permission_ids' => 'required|exists:permissions,id', |
|
28 | + 'role_id' => 'required|array|exists:roles,id' |
|
29 | + ]; |
|
30 | + } |
|
31 | 31 | } |
@@ -6,26 +6,26 @@ |
||
6 | 6 | |
7 | 7 | class UpdateRole 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 | - 'id' => 'required|exists:roles,id', |
|
28 | - 'name' => 'required|string|max:100|unique:roles,name,'.$this->get('id') |
|
29 | - ]; |
|
30 | - } |
|
19 | + /** |
|
20 | + * Get the validation rules that apply to the request. |
|
21 | + * |
|
22 | + * @return array |
|
23 | + */ |
|
24 | + public function rules() |
|
25 | + { |
|
26 | + return [ |
|
27 | + 'id' => 'required|exists:roles,id', |
|
28 | + 'name' => 'required|string|max:100|unique:roles,name,'.$this->get('id') |
|
29 | + ]; |
|
30 | + } |
|
31 | 31 | } |
@@ -6,25 +6,25 @@ |
||
6 | 6 | |
7 | 7 | class InsertRole 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 | - 'name' => 'required|string|max:100|unique:roles,name,'.$this->get('id') |
|
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 | + 'name' => 'required|string|max:100|unique:roles,name,'.$this->get('id') |
|
28 | + ]; |
|
29 | + } |
|
30 | 30 | } |
@@ -8,25 +8,25 @@ |
||
8 | 8 | |
9 | 9 | class Role 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 | - if (! $this->resource) { |
|
20 | - return []; |
|
21 | - } |
|
11 | + /** |
|
12 | + * Transform the resource into an array. |
|
13 | + * |
|
14 | + * @param Request $request |
|
15 | + * @return array |
|
16 | + */ |
|
17 | + public function toArray($request) |
|
18 | + { |
|
19 | + if (! $this->resource) { |
|
20 | + return []; |
|
21 | + } |
|
22 | 22 | |
23 | - return [ |
|
24 | - 'id' => $this->id, |
|
25 | - 'name' => $this->name, |
|
26 | - 'users' => UserResource::collection($this->whenLoaded('users')), |
|
27 | - 'permissions' => PermissionResource::collection($this->whenLoaded('permissions')), |
|
28 | - 'created_at' => $this->created_at, |
|
29 | - 'updated_at' => $this->updated_at, |
|
30 | - ]; |
|
31 | - } |
|
23 | + return [ |
|
24 | + 'id' => $this->id, |
|
25 | + 'name' => $this->name, |
|
26 | + 'users' => UserResource::collection($this->whenLoaded('users')), |
|
27 | + 'permissions' => PermissionResource::collection($this->whenLoaded('permissions')), |
|
28 | + 'created_at' => $this->created_at, |
|
29 | + 'updated_at' => $this->updated_at, |
|
30 | + ]; |
|
31 | + } |
|
32 | 32 | } |
@@ -6,30 +6,30 @@ |
||
6 | 6 | |
7 | 7 | class CreateOauthRefreshTokensTable extends Migration |
8 | 8 | { |
9 | - /** |
|
10 | - * Run the migrations. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function up() |
|
15 | - { |
|
16 | - Schema::create('oauth_refresh_tokens', function (Blueprint $table) { |
|
17 | - $table->string('id', 100)->primary(); |
|
18 | - $table->string('access_token_id', 100); |
|
19 | - $table->boolean('revoked'); |
|
20 | - $table->dateTime('expires_at')->nullable(); |
|
9 | + /** |
|
10 | + * Run the migrations. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function up() |
|
15 | + { |
|
16 | + Schema::create('oauth_refresh_tokens', function (Blueprint $table) { |
|
17 | + $table->string('id', 100)->primary(); |
|
18 | + $table->string('access_token_id', 100); |
|
19 | + $table->boolean('revoked'); |
|
20 | + $table->dateTime('expires_at')->nullable(); |
|
21 | 21 | |
22 | - $table->foreign('access_token_id')->references('id')->on('oauth_access_tokens'); |
|
23 | - }); |
|
24 | - } |
|
22 | + $table->foreign('access_token_id')->references('id')->on('oauth_access_tokens'); |
|
23 | + }); |
|
24 | + } |
|
25 | 25 | |
26 | - /** |
|
27 | - * Reverse the migrations. |
|
28 | - * |
|
29 | - * @return void |
|
30 | - */ |
|
31 | - public function down() |
|
32 | - { |
|
33 | - Schema::drop('oauth_refresh_tokens'); |
|
34 | - } |
|
26 | + /** |
|
27 | + * Reverse the migrations. |
|
28 | + * |
|
29 | + * @return void |
|
30 | + */ |
|
31 | + public function down() |
|
32 | + { |
|
33 | + Schema::drop('oauth_refresh_tokens'); |
|
34 | + } |
|
35 | 35 | } |
@@ -9,32 +9,32 @@ |
||
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 | - if (! $this->resource) { |
|
21 | - return []; |
|
22 | - } |
|
12 | + /** |
|
13 | + * Transform the resource into an array. |
|
14 | + * |
|
15 | + * @param Request $request |
|
16 | + * @return array |
|
17 | + */ |
|
18 | + public function toArray($request) |
|
19 | + { |
|
20 | + if (! $this->resource) { |
|
21 | + return []; |
|
22 | + } |
|
23 | 23 | |
24 | - return [ |
|
25 | - 'id' => $this->id, |
|
26 | - 'name' => $this->name, |
|
27 | - 'email' => $this->email, |
|
28 | - 'profilePicture' => $this->profile_picture, |
|
29 | - 'notifications' => NotificationResource::collection($this->whenLoaded('notifications')), |
|
30 | - 'readNotifications' => NotificationResource::collection($this->whenLoaded('readNotifications')), |
|
31 | - 'unreadNotifications' => NotificationResource::collection($this->whenLoaded('unreadNotifications')), |
|
32 | - 'roles' => RoleResource::collection($this->whenLoaded('roles')), |
|
33 | - 'oauthClients' => OauthClientResource::collection($this->whenLoaded('oauthClients')), |
|
34 | - 'locale' => $this->locale, |
|
35 | - 'timezone' => $this->timezone, |
|
36 | - 'created_at' => $this->created_at, |
|
37 | - 'updated_at' => $this->updated_at, |
|
38 | - ]; |
|
39 | - } |
|
24 | + return [ |
|
25 | + 'id' => $this->id, |
|
26 | + 'name' => $this->name, |
|
27 | + 'email' => $this->email, |
|
28 | + 'profilePicture' => $this->profile_picture, |
|
29 | + 'notifications' => NotificationResource::collection($this->whenLoaded('notifications')), |
|
30 | + 'readNotifications' => NotificationResource::collection($this->whenLoaded('readNotifications')), |
|
31 | + 'unreadNotifications' => NotificationResource::collection($this->whenLoaded('unreadNotifications')), |
|
32 | + 'roles' => RoleResource::collection($this->whenLoaded('roles')), |
|
33 | + 'oauthClients' => OauthClientResource::collection($this->whenLoaded('oauthClients')), |
|
34 | + 'locale' => $this->locale, |
|
35 | + 'timezone' => $this->timezone, |
|
36 | + 'created_at' => $this->created_at, |
|
37 | + 'updated_at' => $this->updated_at, |
|
38 | + ]; |
|
39 | + } |
|
40 | 40 | } |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | $factory->define(App\Modules\Permissions\Permission::class, function (Faker\Generator $faker) { |
4 | - return [ |
|
5 | - 'name' => $faker->randomElement(['save', 'delete', 'find', 'paginate']), |
|
6 | - 'model' => $faker->randomElement(['users', 'roles', 'settings', 'notifications']), |
|
7 | - 'created_at' => $faker->dateTimeBetween('-1 years', 'now'), |
|
8 | - 'updated_at' => $faker->dateTimeBetween('-1 years', 'now') |
|
9 | - ]; |
|
4 | + return [ |
|
5 | + 'name' => $faker->randomElement(['save', 'delete', 'find', 'paginate']), |
|
6 | + 'model' => $faker->randomElement(['users', 'roles', 'settings', 'notifications']), |
|
7 | + 'created_at' => $faker->dateTimeBetween('-1 years', 'now'), |
|
8 | + 'updated_at' => $faker->dateTimeBetween('-1 years', 'now') |
|
9 | + ]; |
|
10 | 10 | }); |
@@ -7,24 +7,24 @@ |
||
7 | 7 | |
8 | 8 | class Permission 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 | - if (! $this->resource) { |
|
19 | - return []; |
|
20 | - } |
|
10 | + /** |
|
11 | + * Transform the resource into an array. |
|
12 | + * |
|
13 | + * @param Request $request |
|
14 | + * @return array |
|
15 | + */ |
|
16 | + public function toArray($request) |
|
17 | + { |
|
18 | + if (! $this->resource) { |
|
19 | + return []; |
|
20 | + } |
|
21 | 21 | |
22 | - return [ |
|
23 | - 'id' => $this->id, |
|
24 | - 'name' => $this->name, |
|
25 | - 'roles' => RoleResource::collection($this->whenLoaded('roles')), |
|
26 | - 'created_at' => $this->created_at, |
|
27 | - 'updated_at' => $this->updated_at, |
|
28 | - ]; |
|
29 | - } |
|
22 | + return [ |
|
23 | + 'id' => $this->id, |
|
24 | + 'name' => $this->name, |
|
25 | + 'roles' => RoleResource::collection($this->whenLoaded('roles')), |
|
26 | + 'created_at' => $this->created_at, |
|
27 | + 'updated_at' => $this->updated_at, |
|
28 | + ]; |
|
29 | + } |
|
30 | 30 | } |