@@ -35,7 +35,7 @@ |
||
| 35 | 35 | */ |
| 36 | 36 | public function handle() |
| 37 | 37 | { |
| 38 | - Artisan::call('vendor:publish',[ |
|
| 38 | + Artisan::call('vendor:publish', [ |
|
| 39 | 39 | "--tag" => "telescope-assets", |
| 40 | 40 | "--force" => true |
| 41 | 41 | ]); |
@@ -79,16 +79,16 @@ discard block |
||
| 79 | 79 | private function loadRoutes() |
| 80 | 80 | { |
| 81 | 81 | foreach ($this->bootstrapService->getRoutes() as $route) { |
| 82 | - $path = $route['path']; |
|
| 82 | + $path = $route[ 'path' ]; |
|
| 83 | 83 | Route::group([ |
| 84 | - 'prefix' => 'v1/' . str_plural($route['module']), |
|
| 85 | - 'namespace' => $route['controller'], |
|
| 86 | - 'domain' => $route['domain'], |
|
| 87 | - 'middleware' => ['api'], |
|
| 88 | - ], function () use ($path) { |
|
| 84 | + 'prefix' => 'v1/'.str_plural($route[ 'module' ]), |
|
| 85 | + 'namespace' => $route[ 'controller' ], |
|
| 86 | + 'domain' => $route[ 'domain' ], |
|
| 87 | + 'middleware' => [ 'api' ], |
|
| 88 | + ], function() use ($path) { |
|
| 89 | 89 | require $path; |
| 90 | 90 | }); |
| 91 | - Route::model($route['module'], $route['model']); |
|
| 91 | + Route::model($route[ 'module' ], $route[ 'model' ]); |
|
| 92 | 92 | } |
| 93 | 93 | } |
| 94 | 94 | |
@@ -100,11 +100,11 @@ discard block |
||
| 100 | 100 | protected function loadConfigs() |
| 101 | 101 | { |
| 102 | 102 | foreach ($this->bootstrapService->getConfigs() as $config) { |
| 103 | - if (isset($config['filename']) && is_string($config['filename'])) { |
|
| 104 | - $fileName = $config['filename']; |
|
| 105 | - $configName = strtolower(explode('.',$fileName)[0]); |
|
| 103 | + if (isset($config[ 'filename' ]) && is_string($config[ 'filename' ])) { |
|
| 104 | + $fileName = $config[ 'filename' ]; |
|
| 105 | + $configName = strtolower(explode('.', $fileName)[ 0 ]); |
|
| 106 | 106 | $this->mergeConfigFrom( |
| 107 | - $config['path'], $configName |
|
| 107 | + $config[ 'path' ], $configName |
|
| 108 | 108 | ); |
| 109 | 109 | } |
| 110 | 110 | } |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | { |
| 120 | 120 | foreach ($this->bootstrapService->getFactories() as $factory) { |
| 121 | 121 | if (!$this->app->environment('production')) { |
| 122 | - app(Factory::class)->load($factory['path']); |
|
| 122 | + app(Factory::class)->load($factory[ 'path' ]); |
|
| 123 | 123 | } |
| 124 | 124 | } |
| 125 | 125 | } |
@@ -132,15 +132,15 @@ discard block |
||
| 132 | 132 | public function loadMigrations() |
| 133 | 133 | { |
| 134 | 134 | foreach ($this->bootstrapService->getMigrations() as $migration) { |
| 135 | - $this->loadMigrationsFrom($migration['path']); |
|
| 135 | + $this->loadMigrationsFrom($migration[ 'path' ]); |
|
| 136 | 136 | } |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | private function loadPolicies() |
| 140 | 140 | { |
| 141 | 141 | foreach ($this->bootstrapService->getPolicies() as $policy) { |
| 142 | - if (class_implements_interface($policy['class'], ModelPolicyContract::class)) { |
|
| 143 | - Gate::policy($policy['model'], $policy['class']); |
|
| 142 | + if (class_implements_interface($policy[ 'class' ], ModelPolicyContract::class)) { |
|
| 143 | + Gate::policy($policy[ 'model' ], $policy[ 'class' ]); |
|
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | 146 | } |
@@ -149,8 +149,8 @@ discard block |
||
| 149 | 149 | { |
| 150 | 150 | $app = $this->app; |
| 151 | 151 | $service = $this->bootstrapService; |
| 152 | - $this->app->extend('command.seed', function () use ($app, $service) { |
|
| 153 | - return new SeedCommand($app['db'], $service); |
|
| 152 | + $this->app->extend('command.seed', function() use ($app, $service) { |
|
| 153 | + return new SeedCommand($app[ 'db' ], $service); |
|
| 154 | 154 | }); |
| 155 | 155 | } |
| 156 | 156 | |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | foreach ($this->bootstrapService->getModels() as $model) { |
| 169 | 169 | if (class_implements_interface($model, Ownable::class)) { |
| 170 | 170 | Gate::policy($model, OwnershipPolicy::class); |
| 171 | - Gate::define('access', OwnershipPolicy::class . '@access'); |
|
| 171 | + Gate::define('access', OwnershipPolicy::class.'@access'); |
|
| 172 | 172 | } |
| 173 | 173 | } |
| 174 | 174 | } |
@@ -184,8 +184,8 @@ discard block |
||
| 184 | 184 | private function loadListeners() |
| 185 | 185 | { |
| 186 | 186 | foreach ($this->bootstrapService->getEvents() as $event) { |
| 187 | - foreach ($event['listeners'] as $listener) { |
|
| 188 | - Event::listen($event['class'], $listener); |
|
| 187 | + foreach ($event[ 'listeners' ] as $listener) { |
|
| 188 | + Event::listen($event[ 'class' ], $listener); |
|
| 189 | 189 | } |
| 190 | 190 | } |
| 191 | 191 | } |
@@ -176,8 +176,9 @@ discard block |
||
| 176 | 176 | private function loadServiceProviders() |
| 177 | 177 | { |
| 178 | 178 | foreach ($this->bootstrapService->getProviders() as $provider) { |
| 179 | - if ($this->passedRegistrationCondition($provider)) |
|
| 180 | - $this->app->register($provider); |
|
| 179 | + if ($this->passedRegistrationCondition($provider)) { |
|
| 180 | + $this->app->register($provider); |
|
| 181 | + } |
|
| 181 | 182 | } |
| 182 | 183 | } |
| 183 | 184 | |
@@ -192,8 +193,9 @@ discard block |
||
| 192 | 193 | |
| 193 | 194 | private function passedRegistrationCondition($class) |
| 194 | 195 | { |
| 195 | - if (!class_implements_interface($class, ConditionalAutoRegistration::class)) |
|
| 196 | - return true; |
|
| 196 | + if (!class_implements_interface($class, ConditionalAutoRegistration::class)) { |
|
| 197 | + return true; |
|
| 198 | + } |
|
| 197 | 199 | return run_class_function($class, 'registrationCondition'); |
| 198 | 200 | } |
| 199 | 201 | } |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | public function up() |
| 14 | 14 | { |
| 15 | - Schema::create('users', function (Blueprint $table) { |
|
| 15 | + Schema::create('users', function(Blueprint $table) { |
|
| 16 | 16 | $table->increments('id'); |
| 17 | 17 | $table->string('identity_id')->unique(); |
| 18 | 18 | $table->string('email'); |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | public function __construct() |
| 30 | 30 | { |
| 31 | 31 | if (!isset($this->collection) || $this->collection === '') { |
| 32 | - throw new InternalErrorException('Collection name must be specified on migration: ' . get_called_class()); |
|
| 32 | + throw new InternalErrorException('Collection name must be specified on migration: '.get_called_class()); |
|
| 33 | 33 | } |
| 34 | 34 | } |
| 35 | 35 | |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | final public function up() |
| 42 | 42 | { |
| 43 | 43 | if (!Schema::connection($this->connection)->hasTable($this->collection)) { |
| 44 | - Schema::connection($this->connection)->create($this->collection, function (Blueprint $collection) { |
|
| 44 | + Schema::connection($this->connection)->create($this->collection, function(Blueprint $collection) { |
|
| 45 | 45 | if (method_exists($this, 'migrate')) |
| 46 | 46 | $this->migrate($collection); |
| 47 | 47 | }); |
@@ -42,8 +42,9 @@ discard block |
||
| 42 | 42 | { |
| 43 | 43 | if (!Schema::connection($this->connection)->hasTable($this->collection)) { |
| 44 | 44 | Schema::connection($this->connection)->create($this->collection, function (Blueprint $collection) { |
| 45 | - if (method_exists($this, 'migrate')) |
|
| 46 | - $this->migrate($collection); |
|
| 45 | + if (method_exists($this, 'migrate')) { |
|
| 46 | + $this->migrate($collection); |
|
| 47 | + } |
|
| 47 | 48 | }); |
| 48 | 49 | } |
| 49 | 50 | } |
@@ -56,8 +57,9 @@ discard block |
||
| 56 | 57 | final public function down() |
| 57 | 58 | { |
| 58 | 59 | if (Schema::connection($this->connection)->hasTable($this->collection)) { |
| 59 | - if (method_exists($this, 'destroy')) |
|
| 60 | - $this->destroy(); |
|
| 60 | + if (method_exists($this, 'destroy')) { |
|
| 61 | + $this->destroy(); |
|
| 62 | + } |
|
| 61 | 63 | Schema::connection($this->connection)->drop($this->collection); |
| 62 | 64 | } |
| 63 | 65 | } |
@@ -24,15 +24,15 @@ |
||
| 24 | 24 | /* If refresh fails. It usually means the database was only partially migrated or seeded. |
| 25 | 25 | ** Start fresh if that's the case |
| 26 | 26 | **/ |
| 27 | - try{ |
|
| 27 | + try { |
|
| 28 | 28 | $this->artisan('migrate:refresh'); |
| 29 | - } catch (\Exception $e){ |
|
| 29 | + } catch (\Exception $e) { |
|
| 30 | 30 | $this->artisan('cache:model:clear'); |
| 31 | 31 | $this->artisan('migrate:fresh'); |
| 32 | 32 | $this->artisan('migrate:refresh'); |
| 33 | 33 | } |
| 34 | 34 | $this->artisan('db:seed'); |
| 35 | - $this->beforeApplicationDestroyed(function () { |
|
| 35 | + $this->beforeApplicationDestroyed(function() { |
|
| 36 | 36 | RefreshDatabaseState::$migrated = false; |
| 37 | 37 | }); |
| 38 | 38 | } |
@@ -22,13 +22,13 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | //Telescope::night(); |
| 24 | 24 | |
| 25 | - Telescope::filter(function (IncomingEntry $entry) { |
|
| 25 | + Telescope::filter(function(IncomingEntry $entry) { |
|
| 26 | 26 | |
| 27 | - if(is_bool($filter = $this->filterHorizonEntries($entry))){ |
|
| 27 | + if (is_bool($filter = $this->filterHorizonEntries($entry))) { |
|
| 28 | 28 | return $filter; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - if(is_bool($filter = $this->filterCorsRequests($entry))){ |
|
| 31 | + if (is_bool($filter = $this->filterCorsRequests($entry))) { |
|
| 32 | 32 | return $filter; |
| 33 | 33 | } |
| 34 | 34 | |
@@ -46,14 +46,14 @@ discard block |
||
| 46 | 46 | protected function filterHorizonEntries(IncomingEntry $entry) |
| 47 | 47 | { |
| 48 | 48 | if ($entry->type === EntryType::REQUEST |
| 49 | - && isset($entry->content['uri']) |
|
| 50 | - && str_contains($entry->content['uri'], 'horizon')) { |
|
| 49 | + && isset($entry->content[ 'uri' ]) |
|
| 50 | + && str_contains($entry->content[ 'uri' ], 'horizon')) { |
|
| 51 | 51 | return false; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | if ($entry->type === EntryType::EVENT |
| 55 | - && isset($entry->content['name']) |
|
| 56 | - && str_contains($entry->content['name'], 'Horizon')) { |
|
| 55 | + && isset($entry->content[ 'name' ]) |
|
| 56 | + && str_contains($entry->content[ 'name' ], 'Horizon')) { |
|
| 57 | 57 | return false; |
| 58 | 58 | } |
| 59 | 59 | } |
@@ -61,8 +61,8 @@ discard block |
||
| 61 | 61 | protected function filterCorsRequests(IncomingEntry $entry) |
| 62 | 62 | { |
| 63 | 63 | if ($entry->type === EntryType::REQUEST |
| 64 | - && isset($entry->content['method']) |
|
| 65 | - && $entry->content['method'] === 'OPTIONS') { |
|
| 64 | + && isset($entry->content[ 'method' ]) |
|
| 65 | + && $entry->content[ 'method' ] === 'OPTIONS') { |
|
| 66 | 66 | return false; |
| 67 | 67 | } |
| 68 | 68 | } |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | */ |
| 77 | 77 | protected function gate() |
| 78 | 78 | { |
| 79 | - Gate::define('viewTelescope', function ($user) { |
|
| 79 | + Gate::define('viewTelescope', function($user) { |
|
| 80 | 80 | return in_array($user->email, [ |
| 81 | 81 | // |
| 82 | 82 | ]); |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | $this->machineNoUser = new MachineTestModel(null); |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - public function testNoRelation(){ |
|
| 31 | + public function testNoRelation() { |
|
| 32 | 32 | $machineResource = MachineTestTransformer::resource($this->machine)->serialize(); |
| 33 | 33 | $this->assertEmpty($machineResource); |
| 34 | 34 | $this->assertArrayNotHasKey('user', $machineResource); |
@@ -40,13 +40,13 @@ discard block |
||
| 40 | 40 | $this->assertArrayHasKey('user', $machineResource); |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - public function testEmptyRelation(){ |
|
| 43 | + public function testEmptyRelation() { |
|
| 44 | 44 | $machineResource = MachineTestTransformer::resource($this->machineNoUser)->include('user')->serialize(); |
| 45 | 45 | $this->assertArrayHasKey('user', $machineResource); |
| 46 | - $this->assertNull($machineResource['user']); |
|
| 46 | + $this->assertNull($machineResource[ 'user' ]); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - public function testPreIncludedRelation(){ |
|
| 49 | + public function testPreIncludedRelation() { |
|
| 50 | 50 | $machineResource = UserIncludedMachineTestTransformer::resource($this->machine)->serialize(); |
| 51 | 51 | $this->assertArrayHasKey('user', $machineResource); |
| 52 | 52 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | class MachineTestTransformer extends Transformer { |
| 70 | 70 | public function toArray($request) |
| 71 | 71 | { |
| 72 | - return []; |
|
| 72 | + return [ ]; |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | public function transformUser(MachineTestModel $machine) |
@@ -79,13 +79,13 @@ discard block |
||
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | class UserIncludedMachineTestTransformer extends MachineTestTransformer { |
| 82 | - protected $include = ['user']; |
|
| 82 | + protected $include = [ 'user' ]; |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | class UserTestTransformer extends Transformer { |
| 86 | 86 | |
| 87 | 87 | public function toArray($request) |
| 88 | 88 | { |
| 89 | - return []; |
|
| 89 | + return [ ]; |
|
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | 92 | \ No newline at end of file |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | /** |
| 25 | 25 | * ModelCache constructor. |
| 26 | 26 | */ |
| 27 | - public function __construct(string $model, array $indexes = [], $cacheTime = null) |
|
| 27 | + public function __construct(string $model, array $indexes = [ ], $cacheTime = null) |
|
| 28 | 28 | { |
| 29 | 29 | $this->model = $model; |
| 30 | 30 | $this->secondaryIndexes = $indexes; |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | protected function eagerLoadRelations($model) |
| 69 | 69 | { |
| 70 | 70 | if ($model !== null) { |
| 71 | - return $model::eagerLoadRelations([$model])[0]; |
|
| 71 | + return $model::eagerLoadRelations([ $model ])[ 0 ]; |
|
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | 74 | |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | */ |
| 83 | 83 | public function getCacheName($id, string $index = 'id') |
| 84 | 84 | { |
| 85 | - return config('model.cache_prefix') . ':' . strtolower(get_short_class_name($this->model)) . ':' . $index . ':' . $id; |
|
| 85 | + return config('model.cache_prefix').':'.strtolower(get_short_class_name($this->model)).':'.$index.':'.$id; |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | /** |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | private static function deleteWithPrefix($prefix) |
| 142 | 142 | { |
| 143 | 143 | $redis = self::getCacheConnection(); |
| 144 | - $keyPattern = Cache::getPrefix() . $prefix . '*'; |
|
| 144 | + $keyPattern = Cache::getPrefix().$prefix.'*'; |
|
| 145 | 145 | $keys = $redis->keys($keyPattern); |
| 146 | 146 | $redis->delete($keys); |
| 147 | 147 | } |
@@ -167,12 +167,12 @@ discard block |
||
| 167 | 167 | */ |
| 168 | 168 | public function clearModelCache() |
| 169 | 169 | { |
| 170 | - $pattern = config('model.cache_prefix') . ':' . strtolower(get_short_class_name($this->model)); |
|
| 170 | + $pattern = config('model.cache_prefix').':'.strtolower(get_short_class_name($this->model)); |
|
| 171 | 171 | self::deleteWithPrefix($pattern); |
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | public function enabled(): bool |
| 175 | 175 | { |
| 176 | - return (bool)config('model.caching'); |
|
| 176 | + return (bool) config('model.caching'); |
|
| 177 | 177 | } |
| 178 | 178 | } |
@@ -57,8 +57,9 @@ |
||
| 57 | 57 | |
| 58 | 58 | if ($modelId === null) { |
| 59 | 59 | $model = ($this->model)::where($index, $key)->first(); |
| 60 | - if ($model !== null) |
|
| 61 | - $this->store($model); |
|
| 60 | + if ($model !== null) { |
|
| 61 | + $this->store($model); |
|
| 62 | + } |
|
| 62 | 63 | return $model; |
| 63 | 64 | } |
| 64 | 65 | |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | $this->resolver->setDefaultConnection($this->getDatabase()); |
| 36 | 36 | |
| 37 | - Model::unguarded(function () { |
|
| 37 | + Model::unguarded(function() { |
|
| 38 | 38 | foreach ($this->getSeeders() as $seeder) { |
| 39 | 39 | $seeder = $this->laravel->make($seeder); |
| 40 | 40 | if (!isset($seeder->enabled) || $seeder->enabled) |
@@ -49,6 +49,6 @@ discard block |
||
| 49 | 49 | { |
| 50 | 50 | $this->service = $this->laravel->make(BootstrapRegistrarService::class); |
| 51 | 51 | |
| 52 | - return $this->service->getSeeders() ?? []; |
|
| 52 | + return $this->service->getSeeders() ?? [ ]; |
|
| 53 | 53 | } |
| 54 | 54 | } |
@@ -37,8 +37,9 @@ |
||
| 37 | 37 | Model::unguarded(function () { |
| 38 | 38 | foreach ($this->getSeeders() as $seeder) { |
| 39 | 39 | $seeder = $this->laravel->make($seeder); |
| 40 | - if (!isset($seeder->enabled) || $seeder->enabled) |
|
| 41 | - $seeder->__invoke(); |
|
| 40 | + if (!isset($seeder->enabled) || $seeder->enabled) { |
|
| 41 | + $seeder->__invoke(); |
|
| 42 | + } |
|
| 42 | 43 | } |
| 43 | 44 | }); |
| 44 | 45 | |