@@ -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 | } |
@@ -5,14 +5,14 @@ |
||
| 5 | 5 | |
| 6 | 6 | class PermissionRepository extends BaseRepository |
| 7 | 7 | { |
| 8 | - /** |
|
| 9 | - * Init new object. |
|
| 10 | - * |
|
| 11 | - * @param Permission $model |
|
| 12 | - * @return void |
|
| 13 | - */ |
|
| 14 | - public function __construct(Permission $model) |
|
| 15 | - { |
|
| 16 | - parent::__construct($model); |
|
| 17 | - } |
|
| 8 | + /** |
|
| 9 | + * Init new object. |
|
| 10 | + * |
|
| 11 | + * @param Permission $model |
|
| 12 | + * @return void |
|
| 13 | + */ |
|
| 14 | + public function __construct(Permission $model) |
|
| 15 | + { |
|
| 16 | + parent::__construct($model); |
|
| 17 | + } |
|
| 18 | 18 | } |
@@ -6,53 +6,53 @@ |
||
| 6 | 6 | class PermissionObserver |
| 7 | 7 | { |
| 8 | 8 | |
| 9 | - public function saving($model) |
|
| 10 | - { |
|
| 11 | - // |
|
| 12 | - } |
|
| 13 | - |
|
| 14 | - public function saved($model) |
|
| 15 | - { |
|
| 16 | - // |
|
| 17 | - } |
|
| 18 | - |
|
| 19 | - public function creating($model) |
|
| 20 | - { |
|
| 21 | - // |
|
| 22 | - } |
|
| 23 | - |
|
| 24 | - public function created($model) |
|
| 25 | - { |
|
| 26 | - // |
|
| 27 | - } |
|
| 28 | - |
|
| 29 | - public function updating($model) |
|
| 30 | - { |
|
| 31 | - // |
|
| 32 | - } |
|
| 33 | - |
|
| 34 | - public function updated($model) |
|
| 35 | - { |
|
| 36 | - // |
|
| 37 | - } |
|
| 38 | - |
|
| 39 | - public function deleting($model) |
|
| 40 | - { |
|
| 41 | - // |
|
| 42 | - } |
|
| 43 | - |
|
| 44 | - public function deleted($model) |
|
| 45 | - { |
|
| 46 | - // |
|
| 47 | - } |
|
| 48 | - |
|
| 49 | - public function restoring($model) |
|
| 50 | - { |
|
| 51 | - // |
|
| 52 | - } |
|
| 53 | - |
|
| 54 | - public function restored($model) |
|
| 55 | - { |
|
| 56 | - // |
|
| 57 | - } |
|
| 9 | + public function saving($model) |
|
| 10 | + { |
|
| 11 | + // |
|
| 12 | + } |
|
| 13 | + |
|
| 14 | + public function saved($model) |
|
| 15 | + { |
|
| 16 | + // |
|
| 17 | + } |
|
| 18 | + |
|
| 19 | + public function creating($model) |
|
| 20 | + { |
|
| 21 | + // |
|
| 22 | + } |
|
| 23 | + |
|
| 24 | + public function created($model) |
|
| 25 | + { |
|
| 26 | + // |
|
| 27 | + } |
|
| 28 | + |
|
| 29 | + public function updating($model) |
|
| 30 | + { |
|
| 31 | + // |
|
| 32 | + } |
|
| 33 | + |
|
| 34 | + public function updated($model) |
|
| 35 | + { |
|
| 36 | + // |
|
| 37 | + } |
|
| 38 | + |
|
| 39 | + public function deleting($model) |
|
| 40 | + { |
|
| 41 | + // |
|
| 42 | + } |
|
| 43 | + |
|
| 44 | + public function deleted($model) |
|
| 45 | + { |
|
| 46 | + // |
|
| 47 | + } |
|
| 48 | + |
|
| 49 | + public function restoring($model) |
|
| 50 | + { |
|
| 51 | + // |
|
| 52 | + } |
|
| 53 | + |
|
| 54 | + public function restored($model) |
|
| 55 | + { |
|
| 56 | + // |
|
| 57 | + } |
|
| 58 | 58 | } |
@@ -6,33 +6,33 @@ |
||
| 6 | 6 | |
| 7 | 7 | class CreateOauthAuthCodesTable extends Migration |
| 8 | 8 | { |
| 9 | - /** |
|
| 10 | - * Run the migrations. |
|
| 11 | - * |
|
| 12 | - * @return void |
|
| 13 | - */ |
|
| 14 | - public function up() |
|
| 15 | - { |
|
| 16 | - Schema::create('oauth_auth_codes', function (Blueprint $table) { |
|
| 17 | - $table->string('id', 100)->primary(); |
|
| 18 | - $table->unsignedInteger('user_id'); |
|
| 19 | - $table->unsignedInteger('client_id'); |
|
| 20 | - $table->text('scopes')->nullable(); |
|
| 21 | - $table->boolean('revoked'); |
|
| 22 | - $table->dateTime('expires_at')->nullable(); |
|
| 9 | + /** |
|
| 10 | + * Run the migrations. |
|
| 11 | + * |
|
| 12 | + * @return void |
|
| 13 | + */ |
|
| 14 | + public function up() |
|
| 15 | + { |
|
| 16 | + Schema::create('oauth_auth_codes', function (Blueprint $table) { |
|
| 17 | + $table->string('id', 100)->primary(); |
|
| 18 | + $table->unsignedInteger('user_id'); |
|
| 19 | + $table->unsignedInteger('client_id'); |
|
| 20 | + $table->text('scopes')->nullable(); |
|
| 21 | + $table->boolean('revoked'); |
|
| 22 | + $table->dateTime('expires_at')->nullable(); |
|
| 23 | 23 | |
| 24 | - $table->foreign('user_id')->references('id')->on('users'); |
|
| 25 | - $table->foreign('client_id')->references('id')->on('oauth_clients'); |
|
| 26 | - }); |
|
| 27 | - } |
|
| 24 | + $table->foreign('user_id')->references('id')->on('users'); |
|
| 25 | + $table->foreign('client_id')->references('id')->on('oauth_clients'); |
|
| 26 | + }); |
|
| 27 | + } |
|
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * Reverse the migrations. |
|
| 31 | - * |
|
| 32 | - * @return void |
|
| 33 | - */ |
|
| 34 | - public function down() |
|
| 35 | - { |
|
| 36 | - Schema::drop('oauth_auth_codes'); |
|
| 37 | - } |
|
| 29 | + /** |
|
| 30 | + * Reverse the migrations. |
|
| 31 | + * |
|
| 32 | + * @return void |
|
| 33 | + */ |
|
| 34 | + public function down() |
|
| 35 | + { |
|
| 36 | + Schema::drop('oauth_auth_codes'); |
|
| 37 | + } |
|
| 38 | 38 | } |
@@ -6,35 +6,35 @@ |
||
| 6 | 6 | |
| 7 | 7 | class CreateOauthClientsTable extends Migration |
| 8 | 8 | { |
| 9 | - /** |
|
| 10 | - * Run the migrations. |
|
| 11 | - * |
|
| 12 | - * @return void |
|
| 13 | - */ |
|
| 14 | - public function up() |
|
| 15 | - { |
|
| 16 | - Schema::create('oauth_clients', function (Blueprint $table) { |
|
| 17 | - $table->increments('id'); |
|
| 18 | - $table->unsignedInteger('user_id')->nullable(); |
|
| 19 | - $table->string('name'); |
|
| 20 | - $table->string('secret', 100); |
|
| 21 | - $table->text('redirect'); |
|
| 22 | - $table->boolean('personal_access_client')->default(0); |
|
| 23 | - $table->boolean('password_client')->default(0); |
|
| 24 | - $table->boolean('revoked')->default(0); |
|
| 25 | - $table->timestamps(); |
|
| 9 | + /** |
|
| 10 | + * Run the migrations. |
|
| 11 | + * |
|
| 12 | + * @return void |
|
| 13 | + */ |
|
| 14 | + public function up() |
|
| 15 | + { |
|
| 16 | + Schema::create('oauth_clients', function (Blueprint $table) { |
|
| 17 | + $table->increments('id'); |
|
| 18 | + $table->unsignedInteger('user_id')->nullable(); |
|
| 19 | + $table->string('name'); |
|
| 20 | + $table->string('secret', 100); |
|
| 21 | + $table->text('redirect'); |
|
| 22 | + $table->boolean('personal_access_client')->default(0); |
|
| 23 | + $table->boolean('password_client')->default(0); |
|
| 24 | + $table->boolean('revoked')->default(0); |
|
| 25 | + $table->timestamps(); |
|
| 26 | 26 | |
| 27 | - $table->foreign('user_id')->references('id')->on('users'); |
|
| 28 | - }); |
|
| 29 | - } |
|
| 27 | + $table->foreign('user_id')->references('id')->on('users'); |
|
| 28 | + }); |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * Reverse the migrations. |
|
| 33 | - * |
|
| 34 | - * @return void |
|
| 35 | - */ |
|
| 36 | - public function down() |
|
| 37 | - { |
|
| 38 | - Schema::drop('oauth_clients'); |
|
| 39 | - } |
|
| 31 | + /** |
|
| 32 | + * Reverse the migrations. |
|
| 33 | + * |
|
| 34 | + * @return void |
|
| 35 | + */ |
|
| 36 | + public function down() |
|
| 37 | + { |
|
| 38 | + Schema::drop('oauth_clients'); |
|
| 39 | + } |
|
| 40 | 40 | } |
@@ -6,35 +6,35 @@ |
||
| 6 | 6 | |
| 7 | 7 | class CreateOauthAccessTokensTable extends Migration |
| 8 | 8 | { |
| 9 | - /** |
|
| 10 | - * Run the migrations. |
|
| 11 | - * |
|
| 12 | - * @return void |
|
| 13 | - */ |
|
| 14 | - public function up() |
|
| 15 | - { |
|
| 16 | - Schema::create('oauth_access_tokens', function (Blueprint $table) { |
|
| 17 | - $table->string('id', 100)->primary(); |
|
| 18 | - $table->unsignedInteger('user_id')->nullable(); |
|
| 19 | - $table->unsignedInteger('client_id'); |
|
| 20 | - $table->string('name')->nullable(); |
|
| 21 | - $table->text('scopes')->nullable(); |
|
| 22 | - $table->boolean('revoked'); |
|
| 23 | - $table->timestamps(); |
|
| 24 | - $table->dateTime('expires_at')->nullable(); |
|
| 9 | + /** |
|
| 10 | + * Run the migrations. |
|
| 11 | + * |
|
| 12 | + * @return void |
|
| 13 | + */ |
|
| 14 | + public function up() |
|
| 15 | + { |
|
| 16 | + Schema::create('oauth_access_tokens', function (Blueprint $table) { |
|
| 17 | + $table->string('id', 100)->primary(); |
|
| 18 | + $table->unsignedInteger('user_id')->nullable(); |
|
| 19 | + $table->unsignedInteger('client_id'); |
|
| 20 | + $table->string('name')->nullable(); |
|
| 21 | + $table->text('scopes')->nullable(); |
|
| 22 | + $table->boolean('revoked'); |
|
| 23 | + $table->timestamps(); |
|
| 24 | + $table->dateTime('expires_at')->nullable(); |
|
| 25 | 25 | |
| 26 | - $table->foreign('user_id')->references('id')->on('users'); |
|
| 27 | - $table->foreign('client_id')->references('id')->on('oauth_clients'); |
|
| 28 | - }); |
|
| 29 | - } |
|
| 26 | + $table->foreign('user_id')->references('id')->on('users'); |
|
| 27 | + $table->foreign('client_id')->references('id')->on('oauth_clients'); |
|
| 28 | + }); |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * Reverse the migrations. |
|
| 33 | - * |
|
| 34 | - * @return void |
|
| 35 | - */ |
|
| 36 | - public function down() |
|
| 37 | - { |
|
| 38 | - Schema::drop('oauth_access_tokens'); |
|
| 39 | - } |
|
| 31 | + /** |
|
| 32 | + * Reverse the migrations. |
|
| 33 | + * |
|
| 34 | + * @return void |
|
| 35 | + */ |
|
| 36 | + public function down() |
|
| 37 | + { |
|
| 38 | + Schema::drop('oauth_access_tokens'); |
|
| 39 | + } |
|
| 40 | 40 | } |
@@ -6,29 +6,29 @@ |
||
| 6 | 6 | |
| 7 | 7 | class CreateOauthPersonalAccessClientsTable extends Migration |
| 8 | 8 | { |
| 9 | - /** |
|
| 10 | - * Run the migrations. |
|
| 11 | - * |
|
| 12 | - * @return void |
|
| 13 | - */ |
|
| 14 | - public function up() |
|
| 15 | - { |
|
| 16 | - Schema::create('oauth_personal_access_clients', function (Blueprint $table) { |
|
| 17 | - $table->increments('id'); |
|
| 18 | - $table->unsignedInteger('client_id'); |
|
| 19 | - $table->timestamps(); |
|
| 9 | + /** |
|
| 10 | + * Run the migrations. |
|
| 11 | + * |
|
| 12 | + * @return void |
|
| 13 | + */ |
|
| 14 | + public function up() |
|
| 15 | + { |
|
| 16 | + Schema::create('oauth_personal_access_clients', function (Blueprint $table) { |
|
| 17 | + $table->increments('id'); |
|
| 18 | + $table->unsignedInteger('client_id'); |
|
| 19 | + $table->timestamps(); |
|
| 20 | 20 | |
| 21 | - $table->foreign('client_id')->references('id')->on('oauth_clients'); |
|
| 22 | - }); |
|
| 23 | - } |
|
| 21 | + $table->foreign('client_id')->references('id')->on('oauth_clients'); |
|
| 22 | + }); |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * Reverse the migrations. |
|
| 27 | - * |
|
| 28 | - * @return void |
|
| 29 | - */ |
|
| 30 | - public function down() |
|
| 31 | - { |
|
| 32 | - Schema::drop('oauth_personal_access_clients'); |
|
| 33 | - } |
|
| 25 | + /** |
|
| 26 | + * Reverse the migrations. |
|
| 27 | + * |
|
| 28 | + * @return void |
|
| 29 | + */ |
|
| 30 | + public function down() |
|
| 31 | + { |
|
| 32 | + Schema::drop('oauth_personal_access_clients'); |
|
| 33 | + } |
|
| 34 | 34 | } |
@@ -5,37 +5,37 @@ |
||
| 5 | 5 | |
| 6 | 6 | class Users extends Migration |
| 7 | 7 | { |
| 8 | - /** |
|
| 9 | - * Run the migrations. |
|
| 10 | - * |
|
| 11 | - * @return void |
|
| 12 | - */ |
|
| 13 | - public function up() |
|
| 14 | - { |
|
| 15 | - Schema::create('users', function (Blueprint $table) { |
|
| 16 | - $table->increments('id'); |
|
| 17 | - $table->string('profile_picture', 150)->nullable(); |
|
| 18 | - $table->string('name', 100)->nullable(); |
|
| 19 | - $table->string('email')->unique(); |
|
| 20 | - $table->string('password', 60)->nullable(); |
|
| 21 | - $table->boolean('blocked')->default(0); |
|
| 22 | - $table->boolean('confirmed')->default(0); |
|
| 23 | - $table->string('confirmation_code')->nullable(); |
|
| 24 | - $table->string('locale', 2)->default('en'); |
|
| 25 | - $table->string('timezone', 50)->default('Africa/Cairo'); |
|
| 26 | - $table->softDeletes(); |
|
| 27 | - $table->rememberToken(); |
|
| 28 | - $table->timestamps(); |
|
| 29 | - }); |
|
| 30 | - } |
|
| 8 | + /** |
|
| 9 | + * Run the migrations. |
|
| 10 | + * |
|
| 11 | + * @return void |
|
| 12 | + */ |
|
| 13 | + public function up() |
|
| 14 | + { |
|
| 15 | + Schema::create('users', function (Blueprint $table) { |
|
| 16 | + $table->increments('id'); |
|
| 17 | + $table->string('profile_picture', 150)->nullable(); |
|
| 18 | + $table->string('name', 100)->nullable(); |
|
| 19 | + $table->string('email')->unique(); |
|
| 20 | + $table->string('password', 60)->nullable(); |
|
| 21 | + $table->boolean('blocked')->default(0); |
|
| 22 | + $table->boolean('confirmed')->default(0); |
|
| 23 | + $table->string('confirmation_code')->nullable(); |
|
| 24 | + $table->string('locale', 2)->default('en'); |
|
| 25 | + $table->string('timezone', 50)->default('Africa/Cairo'); |
|
| 26 | + $table->softDeletes(); |
|
| 27 | + $table->rememberToken(); |
|
| 28 | + $table->timestamps(); |
|
| 29 | + }); |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * Reverse the migrations. |
|
| 34 | - * |
|
| 35 | - * @return void |
|
| 36 | - */ |
|
| 37 | - public function down() |
|
| 38 | - { |
|
| 39 | - Schema::dropIfExists('users'); |
|
| 40 | - } |
|
| 32 | + /** |
|
| 33 | + * Reverse the migrations. |
|
| 34 | + * |
|
| 35 | + * @return void |
|
| 36 | + */ |
|
| 37 | + public function down() |
|
| 38 | + { |
|
| 39 | + Schema::dropIfExists('users'); |
|
| 40 | + } |
|
| 41 | 41 | } |