@@ -9,43 +9,43 @@ |
||
| 9 | 9 | |
| 10 | 10 | class SetRelations |
| 11 | 11 | { |
| 12 | - protected $arr; |
|
| 13 | - protected $route; |
|
| 14 | - protected $config; |
|
| 12 | + protected $arr; |
|
| 13 | + protected $route; |
|
| 14 | + protected $config; |
|
| 15 | 15 | |
| 16 | - /** |
|
| 17 | - * Init new object. |
|
| 18 | - * |
|
| 19 | - * @param Route $route |
|
| 20 | - * @param Arr $arr |
|
| 21 | - * @param Config $config |
|
| 22 | - * |
|
| 23 | - * @return void |
|
| 24 | - */ |
|
| 25 | - public function __construct(Route $route, Arr $arr, Config $config) |
|
| 26 | - { |
|
| 27 | - $this->arr = $arr; |
|
| 28 | - $this->route = $route; |
|
| 29 | - $this->config = $config->getConfig(); |
|
| 30 | - } |
|
| 16 | + /** |
|
| 17 | + * Init new object. |
|
| 18 | + * |
|
| 19 | + * @param Route $route |
|
| 20 | + * @param Arr $arr |
|
| 21 | + * @param Config $config |
|
| 22 | + * |
|
| 23 | + * @return void |
|
| 24 | + */ |
|
| 25 | + public function __construct(Route $route, Arr $arr, Config $config) |
|
| 26 | + { |
|
| 27 | + $this->arr = $arr; |
|
| 28 | + $this->route = $route; |
|
| 29 | + $this->config = $config->getConfig(); |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * Handle an incoming request. |
|
| 34 | - * |
|
| 35 | - * @param \Illuminate\Http\Request $request |
|
| 36 | - * @param \Closure $next |
|
| 37 | - * @return mixed |
|
| 38 | - */ |
|
| 39 | - public function handle($request, Closure $next) |
|
| 40 | - { |
|
| 41 | - $routeActions = explode('@', $this->route->currentRouteAction()); |
|
| 42 | - $modelName = explode('\\', $routeActions[0]); |
|
| 43 | - $modelName = lcfirst(str_replace('Controller', '', end($modelName))); |
|
| 44 | - $route = explode('@', $this->route->currentRouteAction())[1]; |
|
| 45 | - $route = $route !== 'index' ? $route : 'list'; |
|
| 46 | - $relations = $this->arr->get($this->config['relations'], $modelName, false); |
|
| 47 | - $request->relations = $relations && isset($relations[$route]) ? $relations[$route] : []; |
|
| 32 | + /** |
|
| 33 | + * Handle an incoming request. |
|
| 34 | + * |
|
| 35 | + * @param \Illuminate\Http\Request $request |
|
| 36 | + * @param \Closure $next |
|
| 37 | + * @return mixed |
|
| 38 | + */ |
|
| 39 | + public function handle($request, Closure $next) |
|
| 40 | + { |
|
| 41 | + $routeActions = explode('@', $this->route->currentRouteAction()); |
|
| 42 | + $modelName = explode('\\', $routeActions[0]); |
|
| 43 | + $modelName = lcfirst(str_replace('Controller', '', end($modelName))); |
|
| 44 | + $route = explode('@', $this->route->currentRouteAction())[1]; |
|
| 45 | + $route = $route !== 'index' ? $route : 'list'; |
|
| 46 | + $relations = $this->arr->get($this->config['relations'], $modelName, false); |
|
| 47 | + $request->relations = $relations && isset($relations[$route]) ? $relations[$route] : []; |
|
| 48 | 48 | |
| 49 | - return $next($request); |
|
| 50 | - } |
|
| 49 | + return $next($request); |
|
| 50 | + } |
|
| 51 | 51 | } |
@@ -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 | }); |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -$factory->define(App\Modules\Roles\Role::class, function (Faker\Generator $faker) { |
|
| 3 | +$factory->define(App\Modules\Roles\Role::class, function(Faker\Generator $faker) { |
|
| 4 | 4 | return [ |
| 5 | 5 | 'name' => $faker->unique->word(), |
| 6 | 6 | 'created_at' => $faker->dateTimeBetween('-1 years', 'now'), |
@@ -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 | } |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | public function up() |
| 15 | 15 | { |
| 16 | - Schema::create('oauth_refresh_tokens', function (Blueprint $table) { |
|
| 16 | + Schema::create('oauth_refresh_tokens', function(Blueprint $table) { |
|
| 17 | 17 | $table->string('id', 100)->primary(); |
| 18 | 18 | $table->string('access_token_id', 100); |
| 19 | 19 | $table->boolean('revoked'); |
@@ -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 | }); |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -$factory->define(App\Modules\Permissions\Permission::class, function (Faker\Generator $faker) { |
|
| 3 | +$factory->define(App\Modules\Permissions\Permission::class, function(Faker\Generator $faker) { |
|
| 4 | 4 | return [ |
| 5 | 5 | 'name' => $faker->randomElement(['save', 'delete', 'find', 'paginate']), |
| 6 | 6 | 'model' => $faker->randomElement(['users', 'roles', 'settings', 'notifications']), |
@@ -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 | } |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | */ |
| 18 | 18 | public function toArray($request) |
| 19 | 19 | { |
| 20 | - if (! $this->resource) { |
|
| 20 | + if ( ! $this->resource) { |
|
| 21 | 21 | return []; |
| 22 | 22 | } |
| 23 | 23 | |
@@ -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 | } |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | public function up() |
| 14 | 14 | { |
| 15 | - Schema::create('push_notification_devices', function (Blueprint $table) { |
|
| 15 | + Schema::create('push_notification_devices', function(Blueprint $table) { |
|
| 16 | 16 | $table->increments('id'); |
| 17 | 17 | $table->string('device_token'); |
| 18 | 18 | $table->unsignedInteger('user_id'); |
@@ -5,33 +5,33 @@ |
||
| 5 | 5 | |
| 6 | 6 | class PushNotificationDevices extends Migration |
| 7 | 7 | { |
| 8 | - /** |
|
| 9 | - * Run the migrations. |
|
| 10 | - * |
|
| 11 | - * @return void |
|
| 12 | - */ |
|
| 13 | - public function up() |
|
| 14 | - { |
|
| 15 | - Schema::create('push_notification_devices', function (Blueprint $table) { |
|
| 16 | - $table->increments('id'); |
|
| 17 | - $table->string('device_token'); |
|
| 18 | - $table->unsignedInteger('user_id'); |
|
| 19 | - $table->text('access_token')->nullable(); |
|
| 20 | - $table->unique(array('device_token', 'user_id')); |
|
| 21 | - $table->softDeletes(); |
|
| 22 | - $table->timestamps(); |
|
| 8 | + /** |
|
| 9 | + * Run the migrations. |
|
| 10 | + * |
|
| 11 | + * @return void |
|
| 12 | + */ |
|
| 13 | + public function up() |
|
| 14 | + { |
|
| 15 | + Schema::create('push_notification_devices', function (Blueprint $table) { |
|
| 16 | + $table->increments('id'); |
|
| 17 | + $table->string('device_token'); |
|
| 18 | + $table->unsignedInteger('user_id'); |
|
| 19 | + $table->text('access_token')->nullable(); |
|
| 20 | + $table->unique(array('device_token', 'user_id')); |
|
| 21 | + $table->softDeletes(); |
|
| 22 | + $table->timestamps(); |
|
| 23 | 23 | |
| 24 | - $table->foreign('user_id')->references('id')->on('users'); |
|
| 25 | - }); |
|
| 26 | - } |
|
| 24 | + $table->foreign('user_id')->references('id')->on('users'); |
|
| 25 | + }); |
|
| 26 | + } |
|
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * Reverse the migrations. |
|
| 30 | - * |
|
| 31 | - * @return void |
|
| 32 | - */ |
|
| 33 | - public function down() |
|
| 34 | - { |
|
| 35 | - Schema::dropIfExists('push_notification_devices'); |
|
| 36 | - } |
|
| 28 | + /** |
|
| 29 | + * Reverse the migrations. |
|
| 30 | + * |
|
| 31 | + * @return void |
|
| 32 | + */ |
|
| 33 | + public function down() |
|
| 34 | + { |
|
| 35 | + Schema::dropIfExists('push_notification_devices'); |
|
| 36 | + } |
|
| 37 | 37 | } |
@@ -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 | } |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | public function up() |
| 15 | 15 | { |
| 16 | - Schema::create('oauth_auth_codes', function (Blueprint $table) { |
|
| 16 | + Schema::create('oauth_auth_codes', function(Blueprint $table) { |
|
| 17 | 17 | $table->string('id', 100)->primary(); |
| 18 | 18 | $table->unsignedInteger('user_id'); |
| 19 | 19 | $table->unsignedInteger('client_id'); |