diff --git a/app/Actions/Fortify/CreateNewUser.php b/app/Actions/Fortify/CreateNewUser.php index bc1aa5b9a6a..2beb4365d14 100644 --- a/app/Actions/Fortify/CreateNewUser.php +++ b/app/Actions/Fortify/CreateNewUser.php @@ -1,8 +1,8 @@ $raw['CSRFPreventionToken'], ]); } -} \ No newline at end of file +} diff --git a/app/Data/Node/Access/UserData.php b/app/Data/Node/Access/UserData.php index bc30b20a550..c07054ea3e9 100644 --- a/app/Data/Node/Access/UserData.php +++ b/app/Data/Node/Access/UserData.php @@ -1,12 +1,12 @@ reason() . PHP_EOL . $exception->getMessage() . PHP_EOL . $exception->getTraceAsString(), $exception->getCode(), $exception); - } + public function __construct(Response $response, RequestException $exception) + { + parent::__construct($response->reason() . PHP_EOL . $exception->getMessage() . PHP_EOL . $exception->getTraceAsString(), $exception->getCode(), $exception); + } } diff --git a/app/Exceptions/Repository/RecordNotFoundException.php b/app/Exceptions/Repository/RecordNotFoundException.php index 37bb9b3edaa..990e591d8a6 100644 --- a/app/Exceptions/Repository/RecordNotFoundException.php +++ b/app/Exceptions/Repository/RecordNotFoundException.php @@ -1,6 +1,6 @@ date = $date ?? CarbonImmutable::now(); } diff --git a/app/Extensions/Spatie/Fractal/RecursiveSerializer.php b/app/Extensions/Spatie/Fractal/RecursiveSerializer.php index 7947d6b915d..f79c5f6a83b 100644 --- a/app/Extensions/Spatie/Fractal/RecursiveSerializer.php +++ b/app/Extensions/Spatie/Fractal/RecursiveSerializer.php @@ -1,6 +1,6 @@ recursiveInclude( - $include, $data[$include], $includedData[$include], + $include, + $data[$include], + $includedData[$include], ); } } @@ -58,11 +60,13 @@ public function mergeIncludes(array $transformedData, array $includedData): arra foreach ($includedData as $key => $value) { if (isset($transformedData[$key])) { $transformedData[$key] = $this->recursiveInclude( - $key, $transformedData[$key], $value, + $key, + $transformedData[$key], + $value, ); } } return $transformedData; } -} \ No newline at end of file +} diff --git a/app/Facades/Activity.php b/app/Facades/Activity.php index 9e2bc4307d1..2d079dd2b91 100644 --- a/app/Facades/Activity.php +++ b/app/Facades/Activity.php @@ -1,9 +1,9 @@ paginate(min($request->query('per_page', 50), 100))->appends( - $request->query(), - ); + $request->query(), + ); return fractal($addresses, new AddressTransformer())->parseIncludes($request->include) ->respond(); @@ -104,9 +103,10 @@ public function store(StoreAddressRequest $request, AddressPool $addressPool) } public function update( - UpdateAddressRequest $request, AddressPool $addressPool, Address $address, - ) - { + UpdateAddressRequest $request, + AddressPool $addressPool, + Address $address, + ) { $address = $this->connection->transaction(function () use ($request, $address) { $oldLinkedServer = $address->server; diff --git a/app/Http/Controllers/Admin/AddressPools/AddressPoolController.php b/app/Http/Controllers/Admin/AddressPools/AddressPoolController.php index 6e79cbdd614..a0a1c9fc282 100644 --- a/app/Http/Controllers/Admin/AddressPools/AddressPoolController.php +++ b/app/Http/Controllers/Admin/AddressPools/AddressPoolController.php @@ -1,15 +1,15 @@ defaultSort('-id') ->allowedFilters( ['name', AllowedFilter::custom( - '*', new FiltersAddressPoolWildcard(), + '*', + new FiltersAddressPoolWildcard(), )], ) ->paginate(min($request->query('per_page', 50), 100))->appends( - $request->query(), - ); + $request->query(), + ); return fractal($addressPools, new AddressPoolTransformer())->respond(); } @@ -51,8 +52,8 @@ public function getAttachedNodes(Request $request, AddressPool $addressPool) ), AllowedFilter::custom('*', new FiltersNodeWildcard())], ) ->paginate(min($request->query('per_page', 50), 100))->appends( - $request->query(), - ); + $request->query(), + ); return fractal($nodes, new NodeTransformer())->respond(); } diff --git a/app/Http/Controllers/Admin/CotermController.php b/app/Http/Controllers/Admin/CotermController.php index 8200e312362..558216440e5 100644 --- a/app/Http/Controllers/Admin/CotermController.php +++ b/app/Http/Controllers/Admin/CotermController.php @@ -1,19 +1,19 @@ defaultSort('-id') ->allowedFilters( ['name', AllowedFilter::custom( - '*', new FiltersCotermWildcard(), + '*', + new FiltersCotermWildcard(), )], ) ->paginate(min($request->query('per_page', 50), 100))->appends( - $request->query(), - ); + $request->query(), + ); return fractal($addressPools, new CotermTransformer())->respond(); } @@ -91,8 +92,8 @@ public function getAttachedNodes(Request $request, Coterm $coterm) ), AllowedFilter::custom('*', new FiltersNodeWildcard())], ) ->paginate(min($request->query('per_page', 50), 100))->appends( - $request->query(), - ); + $request->query(), + ); return fractal($nodes, new NodeTransformer())->respond(); } diff --git a/app/Http/Controllers/Admin/LocationController.php b/app/Http/Controllers/Admin/LocationController.php index f632385705f..a6acffad438 100644 --- a/app/Http/Controllers/Admin/LocationController.php +++ b/app/Http/Controllers/Admin/LocationController.php @@ -1,12 +1,12 @@ defaultSort('-id') // @phpstan-ignore-next-line ->allowedFilters( - ['short_code', AllowedFilter::custom('*', new FiltersLocationWildcard())], - ) + ['short_code', AllowedFilter::custom('*', new FiltersLocationWildcard())], + ) ->paginate(min($request->query('per_page', 50), 100))->appends( - $request->query(), - ); + $request->query(), + ); return fractal($locations, new LocationTransformer())->respond(); } diff --git a/app/Http/Controllers/Admin/Nodes/AddressController.php b/app/Http/Controllers/Admin/Nodes/AddressController.php index c7bd5afb942..4d3eab21477 100644 --- a/app/Http/Controllers/Admin/Nodes/AddressController.php +++ b/app/Http/Controllers/Admin/Nodes/AddressController.php @@ -1,11 +1,11 @@ nullable()], ) ->paginate(min($request->query('per_page', 50), 100))->appends( - $request->query(), - ); + $request->query(), + ); return fractal($addresses, new AddressTransformer())->parseIncludes($request->include) ->respond(); diff --git a/app/Http/Controllers/Admin/Nodes/IsoController.php b/app/Http/Controllers/Admin/Nodes/IsoController.php index a34ba343d0b..8bd15495c6c 100644 --- a/app/Http/Controllers/Admin/Nodes/IsoController.php +++ b/app/Http/Controllers/Admin/Nodes/IsoController.php @@ -1,18 +1,18 @@ where('iso_library.node_id', $node->id) ->allowedFilters(['name']) ->paginate(min($request->query('per_page', 50), 100))->appends( - $request->query(), - ); + $request->query(), + ); return fractal($isos, new IsoTransformer())->respond(); } @@ -48,7 +48,11 @@ public function store(StoreIsoRequest $request, Node $node) ]) : null; $iso = $this->isoService->download( - $node, $request->name, $request->file_name, $request->link, $checksumData, + $node, + $request->name, + $request->file_name, + $request->link, + $checksumData, $request->hidden, ); } else { diff --git a/app/Http/Controllers/Admin/Nodes/NodeController.php b/app/Http/Controllers/Admin/Nodes/NodeController.php index 7b3ade1e4fd..e74d36fbde2 100644 --- a/app/Http/Controllers/Admin/Nodes/NodeController.php +++ b/app/Http/Controllers/Admin/Nodes/NodeController.php @@ -1,13 +1,13 @@ paginate(min($request->query('per_page', 50), 100))->appends( - $request->query(), - ); + $request->query(), + ); return fractal($nodes, new NodeTransformer())->respond(); } diff --git a/app/Http/Controllers/Admin/Nodes/TemplateController.php b/app/Http/Controllers/Admin/Nodes/TemplateController.php index 595fe6c586d..845b0b0fe52 100644 --- a/app/Http/Controllers/Admin/Nodes/TemplateController.php +++ b/app/Http/Controllers/Admin/Nodes/TemplateController.php @@ -1,14 +1,14 @@ update($request->validated()); return fractal($template, new TemplateTransformer())->respond(); @@ -52,13 +54,15 @@ public function destroy(Node $node, TemplateGroup $templateGroup, Template $temp } public function updateOrder( - UpdateTemplateOrderRequest $request, Node $node, TemplateGroup $templateGroup, - ) - { + UpdateTemplateOrderRequest $request, + Node $node, + TemplateGroup $templateGroup, + ) { Template::setNewOrder($request->order); return fractal( - $templateGroup->templates()->ordered()->get(), new TemplateTransformer(), + $templateGroup->templates()->ordered()->get(), + new TemplateTransformer(), )->respond(); } } diff --git a/app/Http/Controllers/Admin/Nodes/TemplateGroupController.php b/app/Http/Controllers/Admin/Nodes/TemplateGroupController.php index 54d409af247..356462ea477 100644 --- a/app/Http/Controllers/Admin/Nodes/TemplateGroupController.php +++ b/app/Http/Controllers/Admin/Nodes/TemplateGroupController.php @@ -1,13 +1,13 @@ allowedFilters( [ AllowedFilter::custom( - '*', new FiltersServerWildcard(), + '*', + new FiltersServerWildcard(), ), AllowedFilter::custom( 'address_pool_id', @@ -59,8 +59,8 @@ public function index(Request $request) ], ) ->paginate(min($request->query('per_page', 50), 100))->appends( - $request->query(), - ); + $request->query(), + ); return fractal($servers, new ServerBuildTransformer())->parseIncludes($request->include) ->respond(); diff --git a/app/Http/Controllers/Admin/TokenController.php b/app/Http/Controllers/Admin/TokenController.php index 14e83dee5ab..7676cdfe0d1 100644 --- a/app/Http/Controllers/Admin/TokenController.php +++ b/app/Http/Controllers/Admin/TokenController.php @@ -1,13 +1,13 @@ defaultSort('-id') ->where('personal_access_tokens.type', ApiKeyType::APPLICATION->value) ->paginate(min($request->query('per_page', 50), 100))->appends( - $request->query(), - ); + $request->query(), + ); return fractal($tokens, new ApiKeyTransformer())->respond(); } diff --git a/app/Http/Controllers/Admin/UserController.php b/app/Http/Controllers/Admin/UserController.php index de8cf9cbb43..405ae7b247b 100644 --- a/app/Http/Controllers/Admin/UserController.php +++ b/app/Http/Controllers/Admin/UserController.php @@ -1,16 +1,16 @@ paginate(min($request->query('per_page', 50), 100))->appends( - $request->query(), - ); + $request->query(), + ); return fractal($users, new UserTransformer())->respond(); } diff --git a/app/Http/Controllers/ApiController.php b/app/Http/Controllers/ApiController.php index d322d0b00d0..f1c61750cce 100644 --- a/app/Http/Controllers/ApiController.php +++ b/app/Http/Controllers/ApiController.php @@ -1,6 +1,6 @@ detailService->getByProxmox($server), new ServerDetailTransformer(), + $this->detailService->getByProxmox($server), + new ServerDetailTransformer(), )->respond(); } public function getState(Server $server) { return fractal()->item( - $this->serverRepository->setServer($server)->getState(), new ServerStateTransformer(), + $this->serverRepository->setServer($server)->getState(), + new ServerStateTransformer(), )->respond(); } @@ -84,7 +85,9 @@ public function createConsoleSession(CreateConsoleSessionRequest $request, Serve 'fqdn' => $coterm->fqdn, 'port' => $coterm->port, 'token' => $this->cotermJWTService->handle( - $server, $request->user(), $request->enum('type', ConsoleType::class), + $server, + $request->user(), + $request->enum('type', ConsoleType::class), ) ->toString(), ], diff --git a/app/Http/Controllers/Client/Servers/SettingsController.php b/app/Http/Controllers/Client/Servers/SettingsController.php index f97fdd549ac..ad9f9bbca51 100644 --- a/app/Http/Controllers/Client/Servers/SettingsController.php +++ b/app/Http/Controllers/Client/Servers/SettingsController.php @@ -1,32 +1,32 @@ get(); } else { $templateGroups = $templateGroups->where( - 'template_groups.node_id', '=', $server->node->id, + 'template_groups.node_id', + '=', + $server->node->id, ) ->with(['templates' => function ($query) { $query->orderBy('order_column'); diff --git a/app/Http/Controllers/Client/Servers/SnapshotController.php b/app/Http/Controllers/Client/Servers/SnapshotController.php index cbe640d66a7..0e51d353bd8 100644 --- a/app/Http/Controllers/Client/Servers/SnapshotController.php +++ b/app/Http/Controllers/Client/Servers/SnapshotController.php @@ -1,10 +1,10 @@ enum('from', StatisticTimeRange::class); $consolidator = $request->enum( - 'consolidator', StatisticConsolidatorFunction::class, + 'consolidator', + StatisticConsolidatorFunction::class, ) ?? StatisticConsolidatorFunction::AVERAGE; $data = $this->statisticsRepository->setServer($server)->getStatistics( - $from, $consolidator, + $from, + $consolidator, ); return fractal($data, new ServerTimepointDataTransformer())->respond(); diff --git a/app/Http/Controllers/Client/SessionController.php b/app/Http/Controllers/Client/SessionController.php index 7443e643930..b25b55b6a9e 100644 --- a/app/Http/Controllers/Client/SessionController.php +++ b/app/Http/Controllers/Client/SessionController.php @@ -1,8 +1,8 @@ */ protected $middleware = [ - // \Convoy\Http\Middleware\TrustHosts::class, + // \App\Http\Middleware\TrustHosts::class, TrustProxies::class, HandleCors::class, PreventRequestsDuringMaintenance::class, diff --git a/app/Http/Middleware/Activity/AccountSubject.php b/app/Http/Middleware/Activity/AccountSubject.php index ee5e6e12252..b2dff5feccf 100644 --- a/app/Http/Middleware/Activity/AccountSubject.php +++ b/app/Http/Middleware/Activity/AccountSubject.php @@ -1,9 +1,9 @@ route()->parameter('server'); diff --git a/app/Http/Middleware/Client/Server/ServerNotInstalled.php b/app/Http/Middleware/Client/Server/ServerNotInstalled.php index eff3d948c6b..741b2bb0f9d 100644 --- a/app/Http/Middleware/Client/Server/ServerNotInstalled.php +++ b/app/Http/Middleware/Client/Server/ServerNotInstalled.php @@ -1,9 +1,9 @@ route()->parameter('server'); diff --git a/app/Http/Middleware/Client/Server/SubstituteBindings.php b/app/Http/Middleware/Client/Server/SubstituteBindings.php index 3e491989e62..5997089f53a 100644 --- a/app/Http/Middleware/Client/Server/SubstituteBindings.php +++ b/app/Http/Middleware/Client/Server/SubstituteBindings.php @@ -1,9 +1,9 @@ bearerToken())) { throw new HttpException( - 401, 'Access to this endpoint must include an Authorization header.', null, + 401, + 'Access to this endpoint must include an Authorization header.', + null, ['WWW-Authenticate' => 'Bearer'], ); } diff --git a/app/Http/Middleware/EncryptCookies.php b/app/Http/Middleware/EncryptCookies.php index 9012214d711..867695bdcff 100644 --- a/app/Http/Middleware/EncryptCookies.php +++ b/app/Http/Middleware/EncryptCookies.php @@ -1,6 +1,6 @@ headers->set('Accept', 'application/json'); return $next($request); diff --git a/app/Http/Middleware/PreventRequestsDuringMaintenance.php b/app/Http/Middleware/PreventRequestsDuringMaintenance.php index a0af8cb7626..74cbd9a9eaa 100644 --- a/app/Http/Middleware/PreventRequestsDuringMaintenance.php +++ b/app/Http/Middleware/PreventRequestsDuringMaintenance.php @@ -1,6 +1,6 @@ boolean('is_bulk_action')) { $pool = $this->parameter('address_pool', AddressPool::class); $rules[] = new ValidateAddressType( - $this->enum('type', AddressType::class), ['address', 'gateway'], + $this->enum('type', AddressType::class), + ['address', 'gateway'], ); $rules[] = new ValidateAddressUniqueness($pool->id); } diff --git a/app/Http/Requests/Admin/AddressPools/Addresses/UpdateAddressRequest.php b/app/Http/Requests/Admin/AddressPools/Addresses/UpdateAddressRequest.php index ccdc4bf2d74..ce3cb32922c 100644 --- a/app/Http/Requests/Admin/AddressPools/Addresses/UpdateAddressRequest.php +++ b/app/Http/Requests/Admin/AddressPools/Addresses/UpdateAddressRequest.php @@ -1,13 +1,13 @@ join( - 'ip_addresses', 'servers.id', '=', + 'ip_addresses', + 'servers.id', + '=', 'ip_addresses.server_id', ) ->where( diff --git a/app/Http/Requests/Admin/Coterms/DeleteCotermRequest.php b/app/Http/Requests/Admin/Coterms/DeleteCotermRequest.php index 27cc37c64e6..7f61e308e70 100644 --- a/app/Http/Requests/Admin/Coterms/DeleteCotermRequest.php +++ b/app/Http/Requests/Admin/Coterms/DeleteCotermRequest.php @@ -1,9 +1,9 @@ string('file_name'))->exists()) { $validator->errors()->add( - 'file_name', __('validation.unique', ['attribute' => 'file name']), + 'file_name', + __('validation.unique', ['attribute' => 'file name']), ); } }, diff --git a/app/Http/Requests/Admin/Nodes/Isos/UpdateIsoRequest.php b/app/Http/Requests/Admin/Nodes/Isos/UpdateIsoRequest.php index 225859c1b59..ab827e65383 100644 --- a/app/Http/Requests/Admin/Nodes/Isos/UpdateIsoRequest.php +++ b/app/Http/Requests/Admin/Nodes/Isos/UpdateIsoRequest.php @@ -1,9 +1,9 @@ parameter('node', Node::class); // multiply memory by memory_overallocate (which indicates how much you can go over) percentage $memory = intval($this->input('memory')) * ((intval( - $this->input('memory_overallocate'), - ) / 100) + 1); + $this->input('memory_overallocate'), + ) / 100) + 1); $disk = intval($this->input('disk')) * ((intval( - $this->input('disk_overallocate'), - ) / 100) + 1); + $this->input('disk_overallocate'), + ) / 100) + 1); if ($memory < $node->memory_allocated) { $validator->errors()->add( - 'memory', 'The memory value is lower than what\'s allocated.', + 'memory', + 'The memory value is lower than what\'s allocated.', ); } if ($disk < $node->disk_allocated) { $validator->errors()->add( - 'disk', 'The disk value is lower than what\'s allocated.', + 'disk', + 'The disk value is lower than what\'s allocated.', ); } }); diff --git a/app/Http/Requests/Admin/Servers/Settings/UpdateBuildRequest.php b/app/Http/Requests/Admin/Servers/Settings/UpdateBuildRequest.php index b409dd5e945..a01566fda00 100644 --- a/app/Http/Requests/Admin/Servers/Settings/UpdateBuildRequest.php +++ b/app/Http/Requests/Admin/Servers/Settings/UpdateBuildRequest.php @@ -1,11 +1,11 @@ $nodeMemoryLimit || $memory < 0) { $validator->errors()->add( - 'limits.memory', 'The memory value exceeds the node\'s limit.', + 'limits.memory', + 'The memory value exceeds the node\'s limit.', ); } if ($disk > $nodeDiskLimit || $disk < 0) { $validator->errors()->add( - 'limits.disk', 'The disk value exceeds the node\'s limit.', + 'limits.disk', + 'The disk value exceeds the node\'s limit.', ); } }); diff --git a/app/Http/Requests/Admin/Tokens/StoreTokenRequest.php b/app/Http/Requests/Admin/Tokens/StoreTokenRequest.php index cefb0cbd38c..2b0e9097602 100644 --- a/app/Http/Requests/Admin/Tokens/StoreTokenRequest.php +++ b/app/Http/Requests/Admin/Tokens/StoreTokenRequest.php @@ -1,6 +1,6 @@ user()->can( - 'createConsoleSession', $this->parameter('server', Server::class), + 'createConsoleSession', + $this->parameter('server', Server::class), ); } diff --git a/app/Http/Requests/Client/Servers/GetStatisticRequest.php b/app/Http/Requests/Client/Servers/GetStatisticRequest.php index f051945a3ee..3d5e1b3656b 100644 --- a/app/Http/Requests/Client/Servers/GetStatisticRequest.php +++ b/app/Http/Requests/Client/Servers/GetStatisticRequest.php @@ -1,10 +1,10 @@ subDays(config('activity.prune_days')), + 'created_at', + '<=', + Carbon::now()->subDays(config('activity.prune_days')), ); } } diff --git a/app/Models/ActivityLogSubject.php b/app/Models/ActivityLogSubject.php index 4eb444f108e..685adbda7b5 100644 --- a/app/Models/ActivityLogSubject.php +++ b/app/Models/ActivityLogSubject.php @@ -1,6 +1,6 @@ belongsToMany( - Node::class, 'address_pool_to_node', 'address_pool_id', 'node_id', + Node::class, + 'address_pool_to_node', + 'address_pool_id', + 'node_id', ); } diff --git a/app/Models/AddressPoolToNode.php b/app/Models/AddressPoolToNode.php index cdfd793dcf9..0077e64175f 100644 --- a/app/Models/AddressPoolToNode.php +++ b/app/Models/AddressPoolToNode.php @@ -1,6 +1,6 @@ where('id', $value) ->orWhereRaw('LOWER(name) LIKE ?', ["%$value%"]); } -} \ No newline at end of file +} diff --git a/app/Models/Filters/FiltersLocationWildcard.php b/app/Models/Filters/FiltersLocationWildcard.php index f44f757b8f7..01165e02765 100644 --- a/app/Models/Filters/FiltersLocationWildcard.php +++ b/app/Models/Filters/FiltersLocationWildcard.php @@ -1,6 +1,6 @@ getKey(), $model->getKeyName()]; } @@ -158,9 +158,9 @@ public function validate(): void $validator = $this->getValidator(); $validator->setData( - // Trying to do self::toArray() here will leave out keys based on the whitelist/blacklist - // for that model. Doing this will return all the attributes in a format that can - // properly be validated. + // Trying to do self::toArray() here will leave out keys based on the whitelist/blacklist + // for that model. Doing this will return all the attributes in a format that can + // properly be validated. $this->addCastAttributesToArray( $this->getAttributes(), $this->getMutatedAttributes(), diff --git a/app/Models/Node.php b/app/Models/Node.php index 2e3bb34d9fe..9af4415c945 100644 --- a/app/Models/Node.php +++ b/app/Models/Node.php @@ -1,8 +1,8 @@ coterm_tls_enabled ? 'https' : 'http', $this->coterm_fqdn, + '%s://%s:%s', + $this->coterm_tls_enabled ? 'https' : 'http', + $this->coterm_fqdn, $this->coterm_port, ); } @@ -133,7 +135,10 @@ public function coterm(): BelongsTo public function storages(): BelongsToMany { return $this->belongsToMany( - Storage::class, 'storage_to_node', 'node_id', 'storage_id', + Storage::class, + 'storage_to_node', + 'node_id', + 'storage_id', ); } diff --git a/app/Models/PersonalAccessToken.php b/app/Models/PersonalAccessToken.php index 3dee51a0d4b..2d534191f22 100644 --- a/app/Models/PersonalAccessToken.php +++ b/app/Models/PersonalAccessToken.php @@ -1,8 +1,8 @@ belongsToMany( - Node::class, 'storage_to_node', 'storage_id', 'node_id', + Node::class, + 'storage_to_node', + 'storage_id', + 'node_id', ); } } diff --git a/app/Models/StorageToNode.php b/app/Models/StorageToNode.php index c0a318b8d46..f270c6c5dae 100644 --- a/app/Models/StorageToNode.php +++ b/app/Models/StorageToNode.php @@ -1,6 +1,6 @@ tokens()->create([ 'type' => $type, 'name' => $name, diff --git a/app/Policies/BackupPolicy.php b/app/Policies/BackupPolicy.php index fc2cd3561f9..927fb2bb39d 100644 --- a/app/Policies/BackupPolicy.php +++ b/app/Policies/BackupPolicy.php @@ -1,15 +1,17 @@ root_admin || $user->id === $server->user_id) { return true; } diff --git a/app/Policies/CotermPolicy.php b/app/Policies/CotermPolicy.php index 88ce5b83fb0..6abaf307067 100644 --- a/app/Policies/CotermPolicy.php +++ b/app/Policies/CotermPolicy.php @@ -1,9 +1,9 @@ */ protected $policies = [ - // 'Convoy\Models\Model' => 'Convoy\Policies\ModelPolicy', + // 'App\Models\Model' => 'App\Policies\ModelPolicy', ]; /** diff --git a/app/Providers/BroadcastServiceProvider.php b/app/Providers/BroadcastServiceProvider.php index fff804a00c7..8e326d05f44 100644 --- a/app/Providers/BroadcastServiceProvider.php +++ b/app/Providers/BroadcastServiceProvider.php @@ -1,6 +1,6 @@ node_id, ]); } -} \ No newline at end of file +} diff --git a/app/Repositories/Eloquent/BackupRepository.php b/app/Repositories/Eloquent/BackupRepository.php index 576a9aa4468..ceb9d66fb57 100644 --- a/app/Repositories/Eloquent/BackupRepository.php +++ b/app/Repositories/Eloquent/BackupRepository.php @@ -1,8 +1,8 @@ node, Node::class); Assert::regex($link, '/^(http|https):\/\//'); diff --git a/app/Repositories/Proxmox/ProxmoxRepository.php b/app/Repositories/Proxmox/ProxmoxRepository.php index cb02cb9a295..dedb1acdaf5 100644 --- a/app/Repositories/Proxmox/ProxmoxRepository.php +++ b/app/Repositories/Proxmox/ProxmoxRepository.php @@ -1,10 +1,10 @@ node, Node::class); return Http::withOptions(array_merge([ diff --git a/app/Repositories/Proxmox/Server/ProxmoxActivityRepository.php b/app/Repositories/Proxmox/Server/ProxmoxActivityRepository.php index 0c7ab27a458..291ca20bd95 100644 --- a/app/Repositories/Proxmox/Server/ProxmoxActivityRepository.php +++ b/app/Repositories/Proxmox/Server/ProxmoxActivityRepository.php @@ -1,11 +1,11 @@ server, Server::class); $response = $this->getHttpClient() diff --git a/app/Repositories/Repository.php b/app/Repositories/Repository.php index 3924b3a4252..22ef8d93627 100644 --- a/app/Repositories/Repository.php +++ b/app/Repositories/Repository.php @@ -1,12 +1,12 @@ whereIn('address', $addresses) @@ -29,7 +28,12 @@ public function handle( $addresses = array_diff($addresses, $existingAddresses); $transformer = function (string $address) use ( - $poolId, $serverId, $type, $cidr, $gateway, $macAddress, + $poolId, + $serverId, + $type, + $cidr, + $gateway, + $macAddress, ) { return [ 'address_pool_id' => $poolId, @@ -54,9 +58,10 @@ public function handle( * } $addresses */ $addresses = Arr::map( - $addresses, $transformer, + $addresses, + $transformer, ); Address::insert($addresses); } -} \ No newline at end of file +} diff --git a/app/Services/Api/JWTService.php b/app/Services/Api/JWTService.php index 36ed1b379fb..870e462cfc2 100644 --- a/app/Services/Api/JWTService.php +++ b/app/Services/Api/JWTService.php @@ -1,8 +1,8 @@ 0) { $previous = $this->eloquentRepository->getBackupsGeneratedDuringTimespan( - $server->id, $period, + $server->id, + $period, ); if ($previous->count() >= $limit) { $message = sprintf( - 'Only %d backups may be generated within a %d second span of time.', $limit, + 'Only %d backups may be generated within a %d second span of time.', + $limit, $period, ); throw new TooManyRequestsHttpException( CarbonImmutable::now()->diffInSeconds( $previous->last()->created_at->addSeconds($period), - ), $message, + ), + $message, ); } } @@ -66,7 +71,8 @@ function () use ($server, $name, $mode, $compressionType, $isLocked) { ]); $upid = $this->proxmoxRepository->setServer($server)->backup( - $mode, $compressionType, + $mode, + $compressionType, ); MonitorBackupJob::dispatch($backup->id, $upid); diff --git a/app/Services/Backups/BackupDeletionService.php b/app/Services/Backups/BackupDeletionService.php index 63d77c3f33c..8b9198852f5 100644 --- a/app/Services/Backups/BackupDeletionService.php +++ b/app/Services/Backups/BackupDeletionService.php @@ -1,18 +1,18 @@ backupRepository->setServer($backup->server)->getBackups(); $archive = collect($archives)->where( - 'volid', "{$backup->server->node->backup_storage}:backup/{$fileName}", + 'volid', + "{$backup->server->node->backup_storage}:backup/{$fileName}", )->first(); $backup->update([ @@ -62,9 +62,11 @@ public function checkCreationProgress(Backup $backup, string $upid, ?Closure $ca } } - public function checkRestorationProgress(Server $server, string $upid, ?Closure $callback = null, - ) - { + public function checkRestorationProgress( + Server $server, + string $upid, + ?Closure $callback = null, + ) { $status = $this->repository->setServer($server)->getStatus($upid); if (Arr::get($status, 'status') === 'running') { diff --git a/app/Services/Backups/PurgeBackupsService.php b/app/Services/Backups/PurgeBackupsService.php index 32f6dcd8efb..70c0ae327d5 100644 --- a/app/Services/Backups/PurgeBackupsService.php +++ b/app/Services/Backups/PurgeBackupsService.php @@ -1,18 +1,17 @@ node->coterm, Coterm::class, + $server->node->coterm, + Coterm::class, 'The server\'s node does not have a Coterm instance.', ); @@ -32,10 +33,11 @@ public function handle(Server $server, User $user, ConsoleType $consoleType): Pl 'console_type' => $consoleType->value, ]) ->handle( - $server->node->coterm->token, $server->node->getCotermConnectionAddress(), + $server->node->coterm->token, + $server->node->getCotermConnectionAddress(), $user->uuid . $server->uuid, ); return $token; } -} \ No newline at end of file +} diff --git a/app/Services/Coterm/CotermTokenCreationService.php b/app/Services/Coterm/CotermTokenCreationService.php index a416fa51fbb..c2f599fb97e 100644 --- a/app/Services/Coterm/CotermTokenCreationService.php +++ b/app/Services/Coterm/CotermTokenCreationService.php @@ -1,8 +1,8 @@ Str::random(Coterm::COTERM_TOKEN_ID_LENGTH), ]; } -} \ No newline at end of file +} diff --git a/app/Services/Isos/IsoMonitorService.php b/app/Services/Isos/IsoMonitorService.php index 9ad442a325b..655b29fbb46 100644 --- a/app/Services/Isos/IsoMonitorService.php +++ b/app/Services/Isos/IsoMonitorService.php @@ -1,11 +1,11 @@ repository->setNode($node)->getFileMetadata($link); return $this->connection->transaction( function () use ( - $queriedFileMetadata, $node, $hidden, $fileName, $link, $name, $checksumData, + $queriedFileMetadata, + $node, + $hidden, + $fileName, + $link, + $name, + $checksumData, ) { $iso = ISO::create([ 'node_id' => $node->id, @@ -40,7 +49,11 @@ function () use ( ]); $upid = $this->repository->setNode($node)->download( - ContentType::ISO, $iso->file_name, $link, true, $checksumData, + ContentType::ISO, + $iso->file_name, + $link, + true, + $checksumData, ); MonitorIsoDownloadJob::dispatch($iso->id, $upid); diff --git a/app/Services/Nodes/ServerRateLimitsSyncService.php b/app/Services/Nodes/ServerRateLimitsSyncService.php index bb3c07f2c81..a579528a183 100644 --- a/app/Services/Nodes/ServerRateLimitsSyncService.php +++ b/app/Services/Nodes/ServerRateLimitsSyncService.php @@ -1,11 +1,11 @@ $addresses->ipv6->first()?->toArray(), ])); $this->lockIps( - $server, array_unique(Arr::flatten($server->addresses()->get(['address'])->toArray())), + $server, + array_unique(Arr::flatten($server->addresses()->get(['address'])->toArray())), 'ipfilter-net0', ); $this->firewallRepository->setServer($server)->updateOptions([ @@ -150,7 +151,8 @@ public function updateAddresses(Server $server, array $addressIds) $addressesToAdd = array_diff($addressIds, $currentAddresses); $addressesToRemove = array_filter( - $currentAddresses, fn ($id) => !in_array($id, $addressIds), + $currentAddresses, + fn ($id) => !in_array($id, $addressIds), ); if (!empty($addressesToAdd)) { diff --git a/app/Services/Servers/ServerAuthService.php b/app/Services/Servers/ServerAuthService.php index 590948888e1..a34dc9db244 100644 --- a/app/Services/Servers/ServerAuthService.php +++ b/app/Services/Servers/ServerAuthService.php @@ -1,9 +1,9 @@ firstOrFail() : null; if ($template) { diff --git a/app/Services/Servers/ServerDeletionService.php b/app/Services/Servers/ServerDeletionService.php index ff42bf91437..976222ac7e7 100644 --- a/app/Services/Servers/ServerDeletionService.php +++ b/app/Services/Servers/ServerDeletionService.php @@ -1,12 +1,12 @@ filter(fn (DiskData $disk) => !$disk->is_media)->toArray())->pluck( 'interface', - )->toArray(), fn ($disk) => in_array($disk, $disksArray), + )->toArray(), + fn ($disk) => in_array($disk, $disksArray), ); if (count($bootOrder) > 0) { @@ -55,7 +55,8 @@ public function handle(Server $server): void if ($diff > 0) { $this->diskRepository->setServer($server)->resizeDisk( - $disk->interface, $server->disk, + $disk->interface, + $server->disk, ); } } diff --git a/app/Transformers/Admin/AddressPoolTransformer.php b/app/Transformers/Admin/AddressPoolTransformer.php index 1a6425b9856..7ec026710dc 100644 --- a/app/Transformers/Admin/AddressPoolTransformer.php +++ b/app/Transformers/Admin/AddressPoolTransformer.php @@ -1,8 +1,8 @@ server) ? $this->item( - $address->server, new ServerTransformer(), + $address->server, + new ServerTransformer(), ) : null; } } diff --git a/app/Transformers/Admin/ApiKeyTransformer.php b/app/Transformers/Admin/ApiKeyTransformer.php index c7577b4f453..2d6a794b9bf 100644 --- a/app/Transformers/Admin/ApiKeyTransformer.php +++ b/app/Transformers/Admin/ApiKeyTransformer.php @@ -1,8 +1,8 @@ validated(); if (!$this->existingAddress) { - if (Address::where([['address_pool_id', '=', $this->addressPoolId], ['address', '=', $data['address']]], + if (Address::where( + [['address_pool_id', '=', $this->addressPoolId], ['address', '=', $data['address']]], )->exists()) { $validator->errors()->add('address', __('validation.unique_exists', ['attribute' => 'address'])); } } else { if ($this->existingAddress !== $data['address'] && Address::where( - [['address_pool_id', '=', $this->addressPoolId], ['address', '=', $data['address']]], - )->exists()) { + [['address_pool_id', '=', $this->addressPoolId], ['address', '=', $data['address']]], + )->exists()) { $validator->errors()->add('address', __('validation.unique_exists', ['attribute' => 'address'])); } } } -} \ No newline at end of file +} diff --git a/bootstrap/app.php b/bootstrap/app.php index e9bb699579d..722c30df1c2 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -28,17 +28,17 @@ $app->singleton( Illuminate\Contracts\Http\Kernel::class, - \Convoy\Http\Kernel::class, + \App\Http\Kernel::class, ); $app->singleton( Illuminate\Contracts\Console\Kernel::class, - Convoy\Console\Kernel::class, + App\Console\Kernel::class, ); $app->singleton( Illuminate\Contracts\Debug\ExceptionHandler::class, - Convoy\Exceptions\Handler::class, + App\Exceptions\Handler::class, ); /* diff --git a/composer.json b/composer.json index b83608f1e6a..ddfa7073107 100644 --- a/composer.json +++ b/composer.json @@ -49,7 +49,7 @@ "app/Helpers/Network.php" ], "psr-4": { - "Convoy\\": "app/", + "App\\": "app/", "Database\\Factories\\": "database/factories/", "Database\\Seeders\\": "database/seeders/" } diff --git a/config/app.php b/config/app.php index c47e064b1c7..3d941694a2b 100644 --- a/config/app.php +++ b/config/app.php @@ -172,15 +172,15 @@ /* * Application Service Providers... */ - Convoy\Providers\ActivityLogServiceProvider::class, - Convoy\Providers\AppServiceProvider::class, - Convoy\Providers\AuthServiceProvider::class, - Convoy\Providers\BroadcastServiceProvider::class, - Convoy\Providers\EventServiceProvider::class, - Convoy\Providers\HorizonServiceProvider::class, - Convoy\Providers\RouteServiceProvider::class, - Convoy\Providers\RepositoryServiceProvider::class, - Convoy\Providers\FortifyServiceProvider::class, + App\Providers\ActivityLogServiceProvider::class, + App\Providers\AppServiceProvider::class, + App\Providers\AuthServiceProvider::class, + App\Providers\BroadcastServiceProvider::class, + App\Providers\EventServiceProvider::class, + App\Providers\HorizonServiceProvider::class, + App\Providers\RouteServiceProvider::class, + App\Providers\RepositoryServiceProvider::class, + App\Providers\FortifyServiceProvider::class, ])->toArray(), /* @@ -196,9 +196,9 @@ 'aliases' => Facade::defaultAliases()->merge([ // Custom Facades - 'Activity' => Convoy\Facades\Activity::class, - 'LogBatch' => Convoy\Facades\LogBatch::class, - 'LogTarget' => Convoy\Facades\LogTarget::class, + 'Activity' => App\Facades\Activity::class, + 'LogBatch' => App\Facades\LogBatch::class, + 'LogTarget' => App\Facades\LogTarget::class, ])->toArray(), ]; diff --git a/config/auth.php b/config/auth.php index 0de49c42200..9548c15de94 100644 --- a/config/auth.php +++ b/config/auth.php @@ -62,7 +62,7 @@ 'providers' => [ 'users' => [ 'driver' => 'eloquent', - 'model' => Convoy\Models\User::class, + 'model' => App\Models\User::class, ], // 'users' => [ diff --git a/config/fortify.php b/config/fortify.php index 358fc33d88a..cec4bc2cfd5 100644 --- a/config/fortify.php +++ b/config/fortify.php @@ -1,6 +1,6 @@ explode( - ',', env( - 'SANCTUM_STATEFUL_DOMAINS', sprintf( - '%s%s', - 'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1', - Sanctum::currentApplicationUrlWithPort(), - ), - ), + ',', + env( + 'SANCTUM_STATEFUL_DOMAINS', + sprintf( + '%s%s', + 'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1', + Sanctum::currentApplicationUrlWithPort(), + ), + ), ), /* @@ -64,8 +66,8 @@ */ 'middleware' => [ - 'verify_csrf_token' => \Convoy\Http\Middleware\VerifyCsrfToken::class, - 'encrypt_cookies' => \Convoy\Http\Middleware\EncryptCookies::class, + 'verify_csrf_token' => \App\Http\Middleware\VerifyCsrfToken::class, + 'encrypt_cookies' => \App\Http\Middleware\EncryptCookies::class, ], ]; diff --git a/database/factories/AddressFactory.php b/database/factories/AddressFactory.php index 8890afd2191..7f9304c3a18 100644 --- a/database/factories/AddressFactory.php +++ b/database/factories/AddressFactory.php @@ -2,7 +2,7 @@ namespace Database\Factories; -use Convoy\Models\Address; +use App\Models\Address; use Illuminate\Database\Eloquent\Factories\Factory; /** diff --git a/database/factories/AddressPoolFactory.php b/database/factories/AddressPoolFactory.php index 372510b0883..b61fa3d22f8 100644 --- a/database/factories/AddressPoolFactory.php +++ b/database/factories/AddressPoolFactory.php @@ -2,7 +2,7 @@ namespace Database\Factories; -use Convoy\Models\AddressPool; +use App\Models\AddressPool; use Illuminate\Database\Eloquent\Factories\Factory; use Illuminate\Support\Carbon; diff --git a/database/factories/BackupFactory.php b/database/factories/BackupFactory.php index 573f2740ddb..35e23cc5dc0 100644 --- a/database/factories/BackupFactory.php +++ b/database/factories/BackupFactory.php @@ -2,8 +2,8 @@ namespace Database\Factories; -use Convoy\Models\Backup; -use Convoy\Models\Server; +use App\Models\Backup; +use App\Models\Server; use Illuminate\Database\Eloquent\Factories\Factory; /** diff --git a/database/factories/ISOFactory.php b/database/factories/ISOFactory.php index ba86105951a..09b575721e8 100644 --- a/database/factories/ISOFactory.php +++ b/database/factories/ISOFactory.php @@ -2,7 +2,7 @@ namespace Database\Factories; -use Convoy\Models\ISO; +use App\Models\ISO; use Illuminate\Database\Eloquent\Factories\Factory; /** diff --git a/database/factories/LocationFactory.php b/database/factories/LocationFactory.php index d574ccc3a56..ca3c124b143 100644 --- a/database/factories/LocationFactory.php +++ b/database/factories/LocationFactory.php @@ -2,7 +2,7 @@ namespace Database\Factories; -use Convoy\Models\Location; +use App\Models\Location; use Illuminate\Database\Eloquent\Factories\Factory; /** diff --git a/database/factories/NodeFactory.php b/database/factories/NodeFactory.php index 29e07160dab..25474c80bb1 100644 --- a/database/factories/NodeFactory.php +++ b/database/factories/NodeFactory.php @@ -2,7 +2,7 @@ namespace Database\Factories; -use Convoy\Models\Node; +use App\Models\Node; use Illuminate\Database\Eloquent\Factories\Factory; class NodeFactory extends Factory diff --git a/database/factories/ServerFactory.php b/database/factories/ServerFactory.php index f858c18d35a..010047147d4 100644 --- a/database/factories/ServerFactory.php +++ b/database/factories/ServerFactory.php @@ -2,8 +2,8 @@ namespace Database\Factories; -use Convoy\Models\Server; -use Convoy\Services\Servers\ServerCreationService; +use App\Models\Server; +use App\Services\Servers\ServerCreationService; use Illuminate\Database\Eloquent\Factories\Factory; use Illuminate\Support\Facades\App; diff --git a/database/factories/SnapshotFactory.php b/database/factories/SnapshotFactory.php index 8503c6cef62..e3c505740e7 100644 --- a/database/factories/SnapshotFactory.php +++ b/database/factories/SnapshotFactory.php @@ -2,7 +2,7 @@ namespace Database\Factories; -use Convoy\Models\Snapshot; +use App\Models\Snapshot; use Illuminate\Database\Eloquent\Factories\Factory; class SnapshotFactory extends Factory diff --git a/database/factories/StorageFactory.php b/database/factories/StorageFactory.php index aa9f036d9f6..70a593a6ce2 100644 --- a/database/factories/StorageFactory.php +++ b/database/factories/StorageFactory.php @@ -2,7 +2,7 @@ namespace Database\Factories; -use Convoy\Models\Storage; +use App\Models\Storage; use Illuminate\Database\Eloquent\Factories\Factory; use function rand; diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php index fe15bf9b5f2..2906d940c06 100644 --- a/database/factories/UserFactory.php +++ b/database/factories/UserFactory.php @@ -2,7 +2,7 @@ namespace Database\Factories; -use Convoy\Models\User; +use App\Models\User; use Illuminate\Database\Eloquent\Factories\Factory; use Illuminate\Support\Str; diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index 6b31dae725b..a01a6ee5507 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -11,9 +11,9 @@ class DatabaseSeeder extends Seeder */ public function run(): void { - // \Convoy\Models\User::factory(10)->create(); + // \App\Models\User::factory(10)->create(); - // \Convoy\Models\User::factory()->create([ + // \App\Models\User::factory()->create([ // 'name' => 'Test User', // 'email' => 'test@example.com', // ]); diff --git a/database/seeders/ServerSeeder.php b/database/seeders/ServerSeeder.php index d62b56b879c..1322d660ff6 100644 --- a/database/seeders/ServerSeeder.php +++ b/database/seeders/ServerSeeder.php @@ -2,11 +2,11 @@ namespace Database\Seeders; -use Convoy\Models\Location; -use Convoy\Models\Node; -use Convoy\Models\Server; -use Convoy\Models\User; -use Convoy\Services\Servers\ServerCreationService; +use App\Models\Location; +use App\Models\Node; +use App\Models\Server; +use App\Models\User; +use App\Services\Servers\ServerCreationService; use Illuminate\Database\Seeder; class ServerSeeder extends Seeder diff --git a/routes/api-admin.php b/routes/api-admin.php index c55c733ad17..9140c34fd18 100644 --- a/routes/api-admin.php +++ b/routes/api-admin.php @@ -1,7 +1,7 @@ group(function () { Route::get( - '/', [Admin\Nodes\TemplateGroupController::class, 'index'], + '/', + [Admin\Nodes\TemplateGroupController::class, 'index'], ); Route::post( - '/', [Admin\Nodes\TemplateGroupController::class, 'store'], + '/', + [Admin\Nodes\TemplateGroupController::class, 'store'], ); Route::post( '/reorder', @@ -104,7 +106,8 @@ }); Route::resource( - 'templates', Admin\Nodes\TemplateController::class, + 'templates', + Admin\Nodes\TemplateController::class, ) ->only(['index', 'store', 'update', 'destroy']); }); @@ -119,7 +122,8 @@ | */ Route::get( - '/addresses', [Admin\Nodes\AddressController::class, 'index'], + '/addresses', + [Admin\Nodes\AddressController::class, 'index'], ); /* @@ -146,7 +150,8 @@ Route::get('/', [Admin\ServerController::class, 'index']); Route::post('/', [Admin\ServerController::class, 'store']); - Route::group(['prefix' => '/{server}', 'middleware' => ValidateServerStatusMiddleware::class], + Route::group( + ['prefix' => '/{server}', 'middleware' => ValidateServerStatusMiddleware::class], function () { Route::get('/', [Admin\ServerController::class, 'show']) ->withoutMiddleware( @@ -165,14 +170,16 @@ function () { ); Route::post( - '/suspend', [Admin\ServerController::class, 'suspend'], + '/suspend', + [Admin\ServerController::class, 'suspend'], ); Route::post( '/unsuspend', [Admin\ServerController::class, 'unsuspend'], ); }); - }); + } + ); }); /* @@ -185,15 +192,18 @@ function () { */ Route::prefix('/address-pools')->group(function () { Route::get( - '/', [Admin\AddressPools\AddressPoolController::class, 'index'], + '/', + [Admin\AddressPools\AddressPoolController::class, 'index'], ); Route::post( - '/', [Admin\AddressPools\AddressPoolController::class, 'store'], + '/', + [Admin\AddressPools\AddressPoolController::class, 'store'], ); Route::prefix('/{address_pool}')->group(function () { Route::get( - '/', [Admin\AddressPools\AddressPoolController::class, 'show'], + '/', + [Admin\AddressPools\AddressPoolController::class, 'show'], ); Route::put( '/', @@ -210,10 +220,12 @@ function () { Route::prefix('/addresses')->group(function () { Route::get( - '/', [Admin\AddressPools\AddressController::class, 'index'], + '/', + [Admin\AddressPools\AddressController::class, 'index'], ); Route::post( - '/', [Admin\AddressPools\AddressController::class, 'store'], + '/', + [Admin\AddressPools\AddressController::class, 'store'], ); Route::put( '/{address}', @@ -260,7 +272,8 @@ function () { ); Route::delete('/', [Admin\CotermController::class, 'destroy']); Route::get( - '/nodes', [Admin\CotermController::class, 'getAttachedNodes'], + '/nodes', + [Admin\CotermController::class, 'getAttachedNodes'], ); Route::put( '/nodes', diff --git a/routes/api-application.php b/routes/api-application.php index 4a60d9fbde4..ecf9a32df21 100644 --- a/routes/api-application.php +++ b/routes/api-application.php @@ -1,7 +1,7 @@ group(function () { Route::get( - '/', [Admin\Nodes\TemplateGroupController::class, 'index'], + '/', + [Admin\Nodes\TemplateGroupController::class, 'index'], ); Route::post( - '/', [Admin\Nodes\TemplateGroupController::class, 'store'], + '/', + [Admin\Nodes\TemplateGroupController::class, 'store'], ); Route::post( '/reorder', @@ -104,7 +106,8 @@ }); Route::apiResource( - 'templates', Admin\Nodes\TemplateController::class, + 'templates', + Admin\Nodes\TemplateController::class, ) ->only(['index', 'store', 'update', 'destroy']); }); @@ -119,7 +122,8 @@ | */ Route::get( - '/addresses', [Admin\Nodes\AddressController::class, 'index'], + '/addresses', + [Admin\Nodes\AddressController::class, 'index'], ); /* @@ -146,7 +150,8 @@ Route::get('/', [Admin\ServerController::class, 'index']); Route::post('/', [Admin\ServerController::class, 'store']); - Route::group(['prefix' => '/{server}', 'middleware' => ValidateServerStatusMiddleware::class], + Route::group( + ['prefix' => '/{server}', 'middleware' => ValidateServerStatusMiddleware::class], function () { Route::get('/', [Admin\ServerController::class, 'show']) ->withoutMiddleware( @@ -165,14 +170,16 @@ function () { ); Route::post( - '/suspend', [Admin\ServerController::class, 'suspend'], + '/suspend', + [Admin\ServerController::class, 'suspend'], ); Route::post( '/unsuspend', [Admin\ServerController::class, 'unsuspend'], ); }); - }); + } + ); }); /* @@ -185,15 +192,18 @@ function () { */ Route::prefix('/address-pools')->group(function () { Route::get( - '/', [Admin\AddressPools\AddressPoolController::class, 'index'], + '/', + [Admin\AddressPools\AddressPoolController::class, 'index'], ); Route::post( - '/', [Admin\AddressPools\AddressPoolController::class, 'store'], + '/', + [Admin\AddressPools\AddressPoolController::class, 'store'], ); Route::prefix('/{address_pool}')->group(function () { Route::get( - '/', [Admin\AddressPools\AddressPoolController::class, 'show'], + '/', + [Admin\AddressPools\AddressPoolController::class, 'show'], ); Route::put( '/', @@ -210,10 +220,12 @@ function () { Route::prefix('/addresses')->group(function () { Route::get( - '/', [Admin\AddressPools\AddressController::class, 'index'], + '/', + [Admin\AddressPools\AddressController::class, 'index'], ); Route::post( - '/', [Admin\AddressPools\AddressController::class, 'store'], + '/', + [Admin\AddressPools\AddressController::class, 'store'], ); Route::put( '/{address}', @@ -265,7 +277,8 @@ function () { ); Route::delete('/', [Admin\CotermController::class, 'destroy']); Route::get( - '/nodes', [Admin\CotermController::class, 'getAttachedNodes'], + '/nodes', + [Admin\CotermController::class, 'getAttachedNodes'], ); Route::put( '/nodes', diff --git a/routes/api-client.php b/routes/api-client.php index c34429e1461..edafd17b319 100644 --- a/routes/api-client.php +++ b/routes/api-client.php @@ -1,8 +1,8 @@ name('servers.show'); Route::get( - '/state', [Client\Servers\ServerController::class, 'getState'], + '/state', + [Client\Servers\ServerController::class, 'getState'], ); Route::patch( - '/state', [Client\Servers\ServerController::class, 'updateState'], + '/state', + [Client\Servers\ServerController::class, 'updateState'], ); Route::post( @@ -37,7 +39,9 @@ Route::prefix('/backups')->group(function () { Route::get('/', [Client\Servers\BackupController::class, 'index']); - Route::post('/', [Client\Servers\BackupController::class, 'store'], + Route::post( + '/', + [Client\Servers\BackupController::class, 'store'], ); Route::post( '/{backup}/restore', @@ -51,7 +55,8 @@ Route::prefix('/settings')->group(function () { Route::post( - '/rename', [Client\Servers\SettingsController::class, 'rename'], + '/rename', + [Client\Servers\SettingsController::class, 'rename'], ); Route::get( '/template-groups', diff --git a/routes/api-coterm.php b/routes/api-coterm.php index 27fbe9665c3..273e5f507d6 100644 --- a/routes/api-coterm.php +++ b/routes/api-coterm.php @@ -1,6 +1,6 @@ group(function () { @@ -8,4 +8,4 @@ '/create-console-session', [Coterm\SessionController::class, 'store'], ); -}); \ No newline at end of file +}); diff --git a/routes/auth.php b/routes/auth.php index febe71b333d..7c072cf7f07 100644 --- a/routes/auth.php +++ b/routes/auth.php @@ -1,6 +1,6 @@ name('index') diff --git a/routes/channels.php b/routes/channels.php index 9c19d8b1c47..9b4981295d2 100644 --- a/routes/channels.php +++ b/routes/channels.php @@ -1,6 +1,6 @@ create([ @@ -53,4 +53,4 @@ $response = $this->actingAs($user)->deleteJson("/api/admin/locations/{$location->id}"); $response->assertNoContent(); -}); \ No newline at end of file +}); diff --git a/tests/Feature/Controllers/Admin/Nodes/AddressControllerTest.php b/tests/Feature/Controllers/Admin/Nodes/AddressControllerTest.php index fcdbc152d24..2ce96df9429 100644 --- a/tests/Feature/Controllers/Admin/Nodes/AddressControllerTest.php +++ b/tests/Feature/Controllers/Admin/Nodes/AddressControllerTest.php @@ -1,10 +1,10 @@ user = User::factory()->create([ @@ -25,4 +25,4 @@ ); $response->assertOk(); -}); \ No newline at end of file +}); diff --git a/tests/Feature/Controllers/Admin/Nodes/IsoControllerTest.php b/tests/Feature/Controllers/Admin/Nodes/IsoControllerTest.php index ddc75b16f1e..0f432d699cf 100644 --- a/tests/Feature/Controllers/Admin/Nodes/IsoControllerTest.php +++ b/tests/Feature/Controllers/Admin/Nodes/IsoControllerTest.php @@ -1,10 +1,10 @@ user = User::factory()->create([ @@ -90,7 +90,8 @@ '*/storage/*/content/*' => Http::response( file_get_contents( base_path('tests/Fixtures/Repositories/Node/Storage/DeleteIsoData.json'), - ), 200, + ), + 200, ), ]); $iso = ISO::factory()->for($this->node)->create(); @@ -119,4 +120,4 @@ ); $response->assertOk(); -}); \ No newline at end of file +}); diff --git a/tests/Feature/Controllers/Admin/Nodes/NodeControllerTest.php b/tests/Feature/Controllers/Admin/Nodes/NodeControllerTest.php index 72f4dc1b257..0a686c1c3d4 100644 --- a/tests/Feature/Controllers/Admin/Nodes/NodeControllerTest.php +++ b/tests/Feature/Controllers/Admin/Nodes/NodeControllerTest.php @@ -1,10 +1,10 @@ user = User::factory()->create([ diff --git a/tests/Feature/Controllers/Client/Servers/BackupControllerTest.php b/tests/Feature/Controllers/Client/Servers/BackupControllerTest.php index 75504f623bb..a91da62a24d 100644 --- a/tests/Feature/Controllers/Client/Servers/BackupControllerTest.php +++ b/tests/Feature/Controllers/Client/Servers/BackupControllerTest.php @@ -1,17 +1,16 @@ Http::response(['data' => 'upid'], 200), @@ -26,7 +25,8 @@ function testCreateBackup( } $response = $this->actingAs($user)->postJson( - "/api/client/servers/{$server->uuid}/backups", [ + "/api/client/servers/{$server->uuid}/backups", + [ 'name' => 'Test Backup', 'mode' => 'snapshot', 'compression_type' => 'none', @@ -51,14 +51,14 @@ function testCreateBackup( function testRestoreBackups( bool $useSecondUser = false, bool $secondUserIsAdmin = false, -): Closure -{ +): Closure { return function () use ($useSecondUser, $secondUserIsAdmin) { Http::fake([ '*/status/current' => Http::response( file_get_contents( base_path('tests/Fixtures/Repositories/Server/GetStoppedServerStatusData.json'), - ), 200, + ), + 200, ), '*' => Http::response(['data' => 'dummy-upid'], 200), ]); @@ -96,8 +96,7 @@ function testRestoreBackups( function testDeleteBackups( bool $useSecondUser = false, bool $secondUserIsAdmin = false, -): Closure -{ +): Closure { return function () use ($useSecondUser, $secondUserIsAdmin) { Http::fake([ '*' => Http::response(['data' => 'dummy-upid'], 200), @@ -150,7 +149,8 @@ function testDeleteBackups( '*/status/current' => Http::response( file_get_contents( base_path('tests/Fixtures/Repositories/Server/GetStoppedServerStatusData.json'), - ), 200, + ), + 200, ), '*' => Http::response(['data' => 'dummy-upid'], 200), ]); @@ -193,4 +193,4 @@ function testDeleteBackups( it("can't restore backups", testRestoreBackups(true)); it("can't delete backups", testDeleteBackups(true)); -}); \ No newline at end of file +}); diff --git a/tests/Feature/Controllers/Client/Servers/SettingsControllerTest.php b/tests/Feature/Controllers/Client/Servers/SettingsControllerTest.php index 6de633b5f0f..3296044717c 100644 --- a/tests/Feature/Controllers/Client/Servers/SettingsControllerTest.php +++ b/tests/Feature/Controllers/Client/Servers/SettingsControllerTest.php @@ -1,6 +1,6 @@ actingAs($user)->postJson( - "/api/client/servers/{$server->uuid}/settings/rename", [ + "/api/client/servers/{$server->uuid}/settings/rename", + [ 'name' => 'advinservers is king', 'hostname' => 'advinservers.com', ], @@ -27,7 +28,8 @@ '*/config' => Http::response( file_get_contents( base_path('tests/Fixtures/Repositories/Server/GetServerConfigData.json'), - ), 200, + ), + 200, ), '*' => Http::response(['data' => 'dummy-upid'], 200), ]); @@ -35,7 +37,8 @@ [$user, $_, $_, $server] = createServerModel(); $response = $this->actingAs($user)->putJson( - "/api/client/servers/{$server->uuid}/settings/network", [ + "/api/client/servers/{$server->uuid}/settings/network", + [ 'nameservers' => [ '1.1.1.1', '1.0.0.1', @@ -51,7 +54,8 @@ '*/config' => Http::response( file_get_contents( base_path('tests/Fixtures/Repositories/Server/GetServerConfigData.json'), - ), 200, + ), + 200, ), '*' => Http::response(['data' => 'dummy-upid'], 200), ]); @@ -70,7 +74,8 @@ '*/config' => Http::response( file_get_contents( base_path('tests/Fixtures/Repositories/Server/GetServerConfigData.json'), - ), 200, + ), + 200, ), '*' => Http::response(['data' => 'dummy-upid'], 200), ]); @@ -78,7 +83,8 @@ [$user, $_, $_, $server] = createServerModel(); $response = $this->actingAs($user)->putJson( - "/api/client/servers/{$server->uuid}/settings/auth", [ + "/api/client/servers/{$server->uuid}/settings/auth", + [ 'type' => 'password', 'password' => 'Advinservers is king!123', ], @@ -92,7 +98,8 @@ '*/config' => Http::response( file_get_contents( base_path('tests/Fixtures/Repositories/Server/GetServerConfigData.json'), - ), 200, + ), + 200, ), '*' => Http::response(['data' => 'dummy-upid'], 200), ]); @@ -116,7 +123,8 @@ '*/config' => Http::response( file_get_contents( base_path('tests/Fixtures/Repositories/Server/GetServerConfigData.json'), - ), 200, + ), + 200, ), '*' => Http::response(['data' => 'dummy-upid'], 200), ]); diff --git a/tests/Pest.php b/tests/Pest.php index afdb8b85f06..72fccfec995 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -1,9 +1,9 @@ beforeEach(function () { Http::preventStrayRequests(); Queue::fake(); @@ -61,7 +61,7 @@ function createServerModel(): array $user = User::factory()->create(); /** @var Node $node */ $node = Node::factory()->for($location)->create(); - $service = app(Convoy\Services\Servers\ServerCreationService::class); + $service = app(App\Services\Servers\ServerCreationService::class); /** @var Server $server */ $server = Server::factory()->create(function () use ($user, $node, $service) { $uuid = $service->generateUniqueUuidCombo(); diff --git a/tests/Unit/Services/Nodes/ServerRateLimitsSyncServiceTest.php b/tests/Unit/Services/Nodes/ServerRateLimitsSyncServiceTest.php index 5d965aef460..2324e809d1f 100644 --- a/tests/Unit/Services/Nodes/ServerRateLimitsSyncServiceTest.php +++ b/tests/Unit/Services/Nodes/ServerRateLimitsSyncServiceTest.php @@ -1,6 +1,6 @@