diff --git a/.env.ci b/.env.ci index 64e572b64f2..1fc32024c71 100644 --- a/.env.ci +++ b/.env.ci @@ -15,7 +15,7 @@ DB_DATABASE=convoy DB_USERNAME=convoy_user DB_PASSWORD=YzLa2BCBwDGWVkpG -CACHE_DRIVER=redis +CACHE_STORE=redis FILESYSTEM_DISK=local QUEUE_CONNECTION=redis SESSION_DRIVER=redis diff --git a/.env.example b/.env.example index fb7edb7a5f6..6446a001dd0 100644 --- a/.env.example +++ b/.env.example @@ -4,7 +4,16 @@ APP_KEY= APP_DEBUG=true APP_URL=http://localhost +APP_TIMEZONE=UTC +APP_LOCALE=en +APP_FALLBACK_LOCALE=en +APP_FAKER_LOCALE=en_US +APP_MAINTENANCE_DRIVER=file +APP_MAINTENANCE_STORE=database +BCRYPT_ROUNDS=12 + LOG_CHANNEL=stack +LOG_STACK=single LOG_DEPRECATIONS_CHANNEL=null LOG_LEVEL=debug @@ -15,11 +24,14 @@ DB_DATABASE=convoy DB_USERNAME=convoy_user DB_PASSWORD= -CACHE_DRIVER=redis +CACHE_STORE=redis FILESYSTEM_DISK=local QUEUE_CONNECTION=redis SESSION_DRIVER=redis SESSION_LIFETIME=525600 +SESSION_ENCRYPT=false +SESSION_PATH=/ +SESSION_DOMAIN=null REDIS_HOST=redis REDIS_PASSWORD= diff --git a/app/Actions/Fortify/CreateNewUser.php b/app/Actions/Fortify/CreateNewUser.php index bc1aa5b9a6a..3c9e9c5bc4a 100644 --- a/app/Actions/Fortify/CreateNewUser.php +++ b/app/Actions/Fortify/CreateNewUser.php @@ -3,9 +3,9 @@ namespace Convoy\Actions\Fortify; use Convoy\Models\User; -use Illuminate\Validation\Rule; use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\Validator; +use Illuminate\Validation\Rule; use Laravel\Fortify\Contracts\CreatesNewUsers; class CreateNewUser implements CreatesNewUsers diff --git a/app/Actions/Fortify/UpdateUserProfileInformation.php b/app/Actions/Fortify/UpdateUserProfileInformation.php index 331e65f911e..f49aa9f43c8 100644 --- a/app/Actions/Fortify/UpdateUserProfileInformation.php +++ b/app/Actions/Fortify/UpdateUserProfileInformation.php @@ -2,9 +2,9 @@ namespace Convoy\Actions\Fortify; -use Illuminate\Validation\Rule; -use Illuminate\Support\Facades\Validator; use Illuminate\Contracts\Auth\MustVerifyEmail; +use Illuminate\Support\Facades\Validator; +use Illuminate\Validation\Rule; use Laravel\Fortify\Contracts\UpdatesUserProfileInformation; class UpdateUserProfileInformation implements UpdatesUserProfileInformation diff --git a/app/Casts/NullableEncrypter.php b/app/Casts/NullableEncrypter.php index c4dd6756bf9..978c3bbd1b2 100644 --- a/app/Casts/NullableEncrypter.php +++ b/app/Casts/NullableEncrypter.php @@ -2,9 +2,9 @@ namespace Convoy\Casts; -use Illuminate\Database\Eloquent\Model; -use Illuminate\Contracts\Encryption\Encrypter; use Illuminate\Contracts\Database\Eloquent\CastsAttributes; +use Illuminate\Contracts\Encryption\Encrypter; +use Illuminate\Database\Eloquent\Model; class NullableEncrypter implements CastsAttributes { @@ -15,7 +15,7 @@ class NullableEncrypter implements CastsAttributes */ public function get(Model $model, string $key, mixed $value, array $attributes): ?string { - return !empty($value) ? app(Encrypter::class)->decrypt($value) : null; + return ! empty($value) ? app(Encrypter::class)->decrypt($value) : null; } /** @@ -25,6 +25,6 @@ public function get(Model $model, string $key, mixed $value, array $attributes): */ public function set(Model $model, string $key, mixed $value, array $attributes): ?string { - return !empty($value) ? app(Encrypter::class)->encrypt($value) : null; + return ! empty($value) ? app(Encrypter::class)->encrypt($value) : null; } } diff --git a/app/Console/Commands/Maintenance/PruneOrphanedBackupsCommand.php b/app/Console/Commands/Maintenance/PruneOrphanedBackupsCommand.php index d0c31a4fe9d..7784f20edf7 100644 --- a/app/Console/Commands/Maintenance/PruneOrphanedBackupsCommand.php +++ b/app/Console/Commands/Maintenance/PruneOrphanedBackupsCommand.php @@ -3,9 +3,9 @@ namespace Convoy\Console\Commands\Maintenance; use Carbon\CarbonImmutable; -use InvalidArgumentException; -use Illuminate\Console\Command; use Convoy\Repositories\Eloquent\BackupRepository; +use Illuminate\Console\Command; +use InvalidArgumentException; class PruneOrphanedBackupsCommand extends Command { diff --git a/app/Console/Commands/Maintenance/PruneUsersCommand.php b/app/Console/Commands/Maintenance/PruneUsersCommand.php index 1c9b8a31d33..b6750bc1c06 100644 --- a/app/Console/Commands/Maintenance/PruneUsersCommand.php +++ b/app/Console/Commands/Maintenance/PruneUsersCommand.php @@ -2,9 +2,9 @@ namespace Convoy\Console\Commands\Maintenance; +use Convoy\Jobs\Node\PruneUsersJob; use Convoy\Models\Node; use Illuminate\Console\Command; -use Convoy\Jobs\Node\PruneUsersJob; use Illuminate\Console\View\Components\Task; class PruneUsersCommand extends Command diff --git a/app/Console/Commands/Server/UpdateRateLimitsCommand.php b/app/Console/Commands/Server/UpdateRateLimitsCommand.php index 2cfdc7b7512..6dc9c28e1ac 100644 --- a/app/Console/Commands/Server/UpdateRateLimitsCommand.php +++ b/app/Console/Commands/Server/UpdateRateLimitsCommand.php @@ -2,10 +2,10 @@ namespace Convoy\Console\Commands\Server; +use Convoy\Jobs\Node\SyncServerRateLimitsJob; use Convoy\Models\Node; use Illuminate\Console\Command; use Illuminate\Console\View\Components\Task; -use Convoy\Jobs\Node\SyncServerRateLimitsJob; class UpdateRateLimitsCommand extends Command { diff --git a/app/Console/Commands/Server/UpdateUsagesCommand.php b/app/Console/Commands/Server/UpdateUsagesCommand.php index 42b6d77ca25..dce29a4916b 100644 --- a/app/Console/Commands/Server/UpdateUsagesCommand.php +++ b/app/Console/Commands/Server/UpdateUsagesCommand.php @@ -2,9 +2,9 @@ namespace Convoy\Console\Commands\Server; +use Convoy\Jobs\Node\SyncServerUsagesJob; use Convoy\Models\Node; use Illuminate\Console\Command; -use Convoy\Jobs\Node\SyncServerUsagesJob; use Illuminate\Console\View\Components\Task; class UpdateUsagesCommand extends Command diff --git a/app/Console/Commands/User/MakeUserCommand.php b/app/Console/Commands/User/MakeUserCommand.php index e5927689f69..abd97a22ca7 100644 --- a/app/Console/Commands/User/MakeUserCommand.php +++ b/app/Console/Commands/User/MakeUserCommand.php @@ -25,11 +25,11 @@ namespace Convoy\Console\Commands\User; -use Exception; +use Convoy\Exceptions\Model\DataValidationException; use Convoy\Models\User; +use Exception; use Illuminate\Console\Command; use Illuminate\Support\Facades\Hash; -use Convoy\Exceptions\Model\DataValidationException; class MakeUserCommand extends Command { diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php deleted file mode 100644 index fdff99fc683..00000000000 --- a/app/Console/Kernel.php +++ /dev/null @@ -1,48 +0,0 @@ -command('queue:prune-batches')->daily(); - - if (config('backups.prune_age')) { - // Every 30 minutes, run the backup pruning command so that any abandoned backups can be deleted. - $schedule->command(PruneOrphanedBackupsCommand::class)->everyThirtyMinutes(); - } - - if (config('activity.prune_days')) { - $schedule->command(PruneCommand::class, ['--model' => [ActivityLog::class]])->daily(); - } - - $schedule->command(ResetUsagesCommand::class)->daily(); - $schedule->command(PruneUsersCommand::class)->daily(); - $schedule->command(UpdateUsagesCommand::class)->everyFiveMinutes(); - $schedule->command(UpdateRateLimitsCommand::class)->everyTenMinutes(); - } - - /** - * Register the commands for the application. - */ - protected function commands(): void - { - $this->load(__DIR__.'/Commands'); - - //require base_path('routes/console.php'); - } -} diff --git a/app/Contracts/Repository/ActivityRepositoryInterface.php b/app/Contracts/Repository/ActivityRepositoryInterface.php index 8141abfba2b..e20568ffb46 100644 --- a/app/Contracts/Repository/ActivityRepositoryInterface.php +++ b/app/Contracts/Repository/ActivityRepositoryInterface.php @@ -2,8 +2,8 @@ namespace Convoy\Contracts\Repository; -use Convoy\Models\Server; use Convoy\Models\ActivityLog; +use Convoy\Models\Server; interface ActivityRepositoryInterface extends RepositoryInterface { diff --git a/app/Contracts/Repository/RepositoryInterface.php b/app/Contracts/Repository/RepositoryInterface.php index ba61e7521d9..ab9907cc633 100644 --- a/app/Contracts/Repository/RepositoryInterface.php +++ b/app/Contracts/Repository/RepositoryInterface.php @@ -3,10 +3,10 @@ namespace Convoy\Contracts\Repository; use Closure; -use Illuminate\Support\Collection; use Convoy\Exceptions\Model\DataValidationException; -use Illuminate\Contracts\Pagination\LengthAwarePaginator; use Convoy\Exceptions\Repository\RecordNotFoundException; +use Illuminate\Contracts\Pagination\LengthAwarePaginator; +use Illuminate\Support\Collection; interface RepositoryInterface { diff --git a/app/Contracts/Repository/ServerRepositoryInterface.php b/app/Contracts/Repository/ServerRepositoryInterface.php index 5b64f196594..2d048a6c9b6 100644 --- a/app/Contracts/Repository/ServerRepositoryInterface.php +++ b/app/Contracts/Repository/ServerRepositoryInterface.php @@ -2,8 +2,8 @@ namespace Convoy\Contracts\Repository; -use Convoy\Models\Server; use Convoy\Exceptions\Repository\RecordNotFoundException; +use Convoy\Models\Server; interface ServerRepositoryInterface extends RepositoryInterface { diff --git a/app/Data/Helpers/ChecksumData.php b/app/Data/Helpers/ChecksumData.php index 54c7a61466a..b3871235d44 100644 --- a/app/Data/Helpers/ChecksumData.php +++ b/app/Data/Helpers/ChecksumData.php @@ -2,15 +2,14 @@ namespace Convoy\Data\Helpers; -use Spatie\LaravelData\Data; use Convoy\Enums\Helpers\ChecksumAlgorithm; +use Spatie\LaravelData\Data; class ChecksumData extends Data { public function __construct( - public string $checksum, + public string $checksum, public ChecksumAlgorithm $algorithm, - ) - { + ) { } } diff --git a/app/Data/Node/Access/CreateUserData.php b/app/Data/Node/Access/CreateUserData.php index 48313e88c3e..1c6239b0472 100644 --- a/app/Data/Node/Access/CreateUserData.php +++ b/app/Data/Node/Access/CreateUserData.php @@ -3,25 +3,24 @@ namespace Convoy\Data\Node\Access; use Carbon\Carbon; -use Spatie\LaravelData\Data; -use Spatie\LaravelData\Casts\EnumCast; use Convoy\Enums\Node\Access\RealmType; -use Spatie\LaravelData\Attributes\WithCast; -use Spatie\LaravelData\Attributes\Validation\Min; use Spatie\LaravelData\Attributes\Validation\Max; +use Spatie\LaravelData\Attributes\Validation\Min; +use Spatie\LaravelData\Attributes\WithCast; +use Spatie\LaravelData\Casts\EnumCast; +use Spatie\LaravelData\Data; class CreateUserData extends Data { public function __construct( #[WithCast(EnumCast::class)] public RealmType $realm_type, - public bool $enabled, + public bool $enabled, #[Min(1), Max(60)] - public ?string $username = null, + public ?string $username = null, #[Min(1), Max(64)] - public ?string $password = null, - public ?Carbon $expires_at = null, - ) - { + public ?string $password = null, + public ?Carbon $expires_at = null, + ) { } } diff --git a/app/Data/Node/Access/UserCredentialsData.php b/app/Data/Node/Access/UserCredentialsData.php index f1e23e540c7..6b300a03a3f 100644 --- a/app/Data/Node/Access/UserCredentialsData.php +++ b/app/Data/Node/Access/UserCredentialsData.php @@ -2,22 +2,20 @@ namespace Convoy\Data\Node\Access; -use Spatie\LaravelData\Data; use Convoy\Enums\Node\Access\RealmType; +use Spatie\LaravelData\Data; class UserCredentialsData extends Data { public function __construct( - public string $username, + public string $username, public RealmType $realm_type, - public string $ticket, - public string $csrf_token, - ) - { - + public string $ticket, + public string $csrf_token, + ) { } - public static function fromRaw(array $raw): UserCredentialsData + public static function fromRaw(array $raw): self { return new self(...[ 'username' => explode('@', $raw['username'])[0], @@ -26,4 +24,4 @@ public static function fromRaw(array $raw): UserCredentialsData 'csrf_token' => $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..9d3597803b1 100644 --- a/app/Data/Node/Access/UserData.php +++ b/app/Data/Node/Access/UserData.php @@ -3,32 +3,31 @@ namespace Convoy\Data\Node\Access; use Carbon\Carbon; -use Illuminate\Support\Arr; -use Spatie\LaravelData\Data; -use Spatie\LaravelData\Casts\EnumCast; use Convoy\Enums\Node\Access\RealmType; +use Illuminate\Support\Arr; use Spatie\LaravelData\Attributes\WithCast; +use Spatie\LaravelData\Casts\EnumCast; +use Spatie\LaravelData\Data; class UserData extends Data { public function __construct( - public string $username, - public ?string $email, + public string $username, + public ?string $email, #[WithCast(EnumCast::class)] public RealmType $realm_type, - public bool $enabled, - public ?Carbon $expires_at, - ) - { + public bool $enabled, + public ?Carbon $expires_at, + ) { } - public static function fromRaw(array $raw): UserData + public static function fromRaw(array $raw): self { return new self(...[ 'username' => explode('@', $raw['userid'])[0], 'email' => Arr::get($raw, 'email'), 'realm_type' => RealmType::from($raw['realm-type']), - 'enabled' => (bool)$raw['enable'], + 'enabled' => (bool) $raw['enable'], 'expires_at' => Arr::get($raw, 'expire') ? Carbon::createFromTimestamp($raw['expire']) : null, ]); } diff --git a/app/Data/Node/Storage/FileMetaData.php b/app/Data/Node/Storage/FileMetaData.php index 12ced494a30..85b79910f39 100644 --- a/app/Data/Node/Storage/FileMetaData.php +++ b/app/Data/Node/Storage/FileMetaData.php @@ -9,8 +9,7 @@ class FileMetaData extends Data public function __construct( public string $file_name, public string $mime_type, - public int $size, - ) - { + public int $size, + ) { } } diff --git a/app/Data/Node/Storage/IsoData.php b/app/Data/Node/Storage/IsoData.php index 79484df4bf0..20b32a7346e 100644 --- a/app/Data/Node/Storage/IsoData.php +++ b/app/Data/Node/Storage/IsoData.php @@ -8,10 +8,9 @@ class IsoData extends Data { public function __construct( - public string $file_name, - public int $size, + public string $file_name, + public int $size, public CarbonInterface $created_at, - ) - { + ) { } } diff --git a/app/Data/Server/Deployments/CloudinitAddressConfigData.php b/app/Data/Server/Deployments/CloudinitAddressConfigData.php index 6733f429787..03193975ac8 100644 --- a/app/Data/Server/Deployments/CloudinitAddressConfigData.php +++ b/app/Data/Server/Deployments/CloudinitAddressConfigData.php @@ -2,15 +2,14 @@ namespace Convoy\Data\Server\Deployments; -use Spatie\LaravelData\Data; use Convoy\Data\Server\Eloquent\AddressData; +use Spatie\LaravelData\Data; class CloudinitAddressConfigData extends Data { public function __construct( public ?AddressData $ipv4, public ?AddressData $ipv6, - ) - { + ) { } } diff --git a/app/Data/Server/Deployments/ServerDeploymentData.php b/app/Data/Server/Deployments/ServerDeploymentData.php index ff7b5f3dc45..52a561cb51a 100644 --- a/app/Data/Server/Deployments/ServerDeploymentData.php +++ b/app/Data/Server/Deployments/ServerDeploymentData.php @@ -9,12 +9,11 @@ class ServerDeploymentData extends Data { public function __construct( - public Server $server, + public Server $server, public ?Template $template, - public string $account_password, - public bool $should_create_server, - public bool $start_on_completion, - ) - { + public string $account_password, + public bool $should_create_server, + public bool $start_on_completion, + ) { } } diff --git a/app/Data/Server/Eloquent/AddressData.php b/app/Data/Server/Eloquent/AddressData.php index ac7ceca088a..fd84633bcc9 100644 --- a/app/Data/Server/Eloquent/AddressData.php +++ b/app/Data/Server/Eloquent/AddressData.php @@ -2,24 +2,23 @@ namespace Convoy\Data\Server\Eloquent; -use Spatie\LaravelData\Data; -use Spatie\LaravelData\Attributes\Validation\IP; use Spatie\LaravelData\Attributes\Validation\In; +use Spatie\LaravelData\Attributes\Validation\IP; +use Spatie\LaravelData\Data; class AddressData extends Data { public function __construct( - public int $id, - public int $address_pool_id, - public ?int $server_id, + public int $id, + public int $address_pool_id, + public ?int $server_id, #[In(['ipv4', 'ipv6'])] - public string $type, + public string $type, #[IP] - public string $address, - public int $cidr, - public string $gateway, + public string $address, + public int $cidr, + public string $gateway, public ?string $mac_address, - ) - { + ) { } } diff --git a/app/Data/Server/Eloquent/ServerAddressesData.php b/app/Data/Server/Eloquent/ServerAddressesData.php index c9b7c471e90..945dc5cecbd 100644 --- a/app/Data/Server/Eloquent/ServerAddressesData.php +++ b/app/Data/Server/Eloquent/ServerAddressesData.php @@ -2,9 +2,9 @@ namespace Convoy\Data\Server\Eloquent; +use Spatie\LaravelData\Attributes\DataCollectionOf; use Spatie\LaravelData\Data; use Spatie\LaravelData\DataCollection; -use Spatie\LaravelData\Attributes\DataCollectionOf; class ServerAddressesData extends Data { @@ -13,7 +13,6 @@ public function __construct( public DataCollection $ipv4, #[DataCollectionOf(AddressData::class)] public DataCollection $ipv6, - ) - { + ) { } } diff --git a/app/Data/Server/Eloquent/ServerEloquentData.php b/app/Data/Server/Eloquent/ServerEloquentData.php index 8c5fc846546..eb2b5eb61ae 100644 --- a/app/Data/Server/Eloquent/ServerEloquentData.php +++ b/app/Data/Server/Eloquent/ServerEloquentData.php @@ -7,17 +7,16 @@ class ServerEloquentData extends Data { public function __construct( - public int $id, - public string $uuid_short, - public string $uuid, - public int $node_id, - public string $hostname, - public string $name, - public ?string $description, - public ?string $status, + public int $id, + public string $uuid_short, + public string $uuid, + public int $node_id, + public string $hostname, + public string $name, + public ?string $description, + public ?string $status, public ServerUsagesData $usages, public ServerLimitsData $limits, - ) - { + ) { } } diff --git a/app/Data/Server/Eloquent/ServerLimitsData.php b/app/Data/Server/Eloquent/ServerLimitsData.php index 1cb237ddcdc..5ed77d446f3 100644 --- a/app/Data/Server/Eloquent/ServerLimitsData.php +++ b/app/Data/Server/Eloquent/ServerLimitsData.php @@ -7,15 +7,14 @@ class ServerLimitsData extends Data { public function __construct( - public int $cpu, - public int $memory, - public int $disk, - public ?int $snapshots, - public ?int $backups, - public ?int $bandwidth, + public int $cpu, + public int $memory, + public int $disk, + public ?int $snapshots, + public ?int $backups, + public ?int $bandwidth, public ServerAddressesData $addresses, - public ?string $mac_address, - ) - { + public ?string $mac_address, + ) { } } diff --git a/app/Data/Server/Eloquent/ServerUsagesData.php b/app/Data/Server/Eloquent/ServerUsagesData.php index 767c82bf6b0..1d80176646b 100644 --- a/app/Data/Server/Eloquent/ServerUsagesData.php +++ b/app/Data/Server/Eloquent/ServerUsagesData.php @@ -8,7 +8,6 @@ class ServerUsagesData extends Data { public function __construct( public int $bandwidth, - ) - { + ) { } } diff --git a/app/Data/Server/MacAddressData.php b/app/Data/Server/MacAddressData.php index 3d10d9e6fdb..2a0b532b10d 100644 --- a/app/Data/Server/MacAddressData.php +++ b/app/Data/Server/MacAddressData.php @@ -9,7 +9,6 @@ class MacAddressData extends Data public function __construct( public ?string $proxmox, public ?string $eloquent, - ) - { + ) { } } diff --git a/app/Data/Server/Proxmox/Config/AddressConfigData.php b/app/Data/Server/Proxmox/Config/AddressConfigData.php index 0a7e7d1014b..7940bf84cb4 100644 --- a/app/Data/Server/Proxmox/Config/AddressConfigData.php +++ b/app/Data/Server/Proxmox/Config/AddressConfigData.php @@ -9,7 +9,6 @@ class AddressConfigData extends Data public function __construct( public ?AddressData $ipv4, public ?AddressData $ipv6, - ) - { + ) { } } diff --git a/app/Data/Server/Proxmox/Config/AddressData.php b/app/Data/Server/Proxmox/Config/AddressData.php index fdc16652899..cbf4e7cce20 100644 --- a/app/Data/Server/Proxmox/Config/AddressData.php +++ b/app/Data/Server/Proxmox/Config/AddressData.php @@ -8,9 +8,8 @@ class AddressData extends Data { public function __construct( public string $address, - public int $cidr, + public int $cidr, public string $gateway, - ) - { + ) { } } diff --git a/app/Data/Server/Proxmox/Config/DiskData.php b/app/Data/Server/Proxmox/Config/DiskData.php index 8e33fb6c3a2..1c62e28c2be 100644 --- a/app/Data/Server/Proxmox/Config/DiskData.php +++ b/app/Data/Server/Proxmox/Config/DiskData.php @@ -2,23 +2,22 @@ namespace Convoy\Data\Server\Proxmox\Config; -use Spatie\LaravelData\Data; -use Spatie\LaravelData\Casts\EnumCast; use Convoy\Enums\Server\DiskInterface; use Spatie\LaravelData\Attributes\WithCast; +use Spatie\LaravelData\Casts\EnumCast; +use Spatie\LaravelData\Data; class DiskData extends Data { public function __construct( #[WithCast(EnumCast::class)] public DiskInterface $interface, - public bool $is_primary_disk, + public bool $is_primary_disk, - public bool $is_media, - public ?string $media_name, + public bool $is_media, + public ?string $media_name, - public int $size, - ) - { + public int $size, + ) { } } diff --git a/app/Data/Server/Proxmox/Config/MediaData.php b/app/Data/Server/Proxmox/Config/MediaData.php index 00740a063b0..344e2157893 100644 --- a/app/Data/Server/Proxmox/Config/MediaData.php +++ b/app/Data/Server/Proxmox/Config/MediaData.php @@ -8,7 +8,6 @@ class MediaData extends Data { public function __construct( // - ) - { + ) { } } diff --git a/app/Data/Server/Proxmox/Config/ServerConfigData.php b/app/Data/Server/Proxmox/Config/ServerConfigData.php index 1313303b032..a526621ddfc 100644 --- a/app/Data/Server/Proxmox/Config/ServerConfigData.php +++ b/app/Data/Server/Proxmox/Config/ServerConfigData.php @@ -2,20 +2,19 @@ namespace Convoy\Data\Server\Proxmox\Config; +use Spatie\LaravelData\Attributes\DataCollectionOf; use Spatie\LaravelData\Data; use Spatie\LaravelData\DataCollection; -use Spatie\LaravelData\Attributes\DataCollectionOf; class ServerConfigData extends Data { public function __construct( - public string $mac_address, + public string $mac_address, #[DataCollectionOf(DiskData::class)] public DataCollection $boot_order, #[DataCollectionOf(DiskData::class)] public DataCollection $disks, /* public AddressConfigData $addresses */ - ) - { + ) { } } diff --git a/app/Data/Server/Proxmox/Console/NoVncCredentialsData.php b/app/Data/Server/Proxmox/Console/NoVncCredentialsData.php index c5d9d322610..4db2da6790d 100644 --- a/app/Data/Server/Proxmox/Console/NoVncCredentialsData.php +++ b/app/Data/Server/Proxmox/Console/NoVncCredentialsData.php @@ -7,10 +7,9 @@ class NoVncCredentialsData extends Data { public function __construct( - public int $port, + public int $port, public string $ticket, public string $pve_auth_cookie, - ) - { + ) { } -} \ No newline at end of file +} diff --git a/app/Data/Server/Proxmox/Console/XTermCredentialsData.php b/app/Data/Server/Proxmox/Console/XTermCredentialsData.php index f2c57ebb0db..022de72819f 100644 --- a/app/Data/Server/Proxmox/Console/XTermCredentialsData.php +++ b/app/Data/Server/Proxmox/Console/XTermCredentialsData.php @@ -2,18 +2,17 @@ namespace Convoy\Data\Server\Proxmox\Console; -use Spatie\LaravelData\Data; use Convoy\Enums\Node\Access\RealmType; +use Spatie\LaravelData\Data; class XTermCredentialsData extends Data { public function __construct( - public int $port, - public string $ticket, - public string $username, + public int $port, + public string $ticket, + public string $username, public RealmType $realm_type, - public string $pve_auth_cookie, - ) - { + public string $pve_auth_cookie, + ) { } } diff --git a/app/Data/Server/Proxmox/ServerProxmoxData.php b/app/Data/Server/Proxmox/ServerProxmoxData.php index 47ed1fdf8d3..ceebd29a90f 100644 --- a/app/Data/Server/Proxmox/ServerProxmoxData.php +++ b/app/Data/Server/Proxmox/ServerProxmoxData.php @@ -2,20 +2,19 @@ namespace Convoy\Data\Server\Proxmox; -use Spatie\LaravelData\Data; use Convoy\Data\Server\Proxmox\Config\ServerConfigData; +use Spatie\LaravelData\Data; class ServerProxmoxData extends Data { public function __construct( - public int $id, - public string $uuid_short, - public string $uuid, - public int $node_id, - public string $state, - public bool $locked, + public int $id, + public string $uuid_short, + public string $uuid, + public int $node_id, + public string $state, + public bool $locked, public ServerConfigData $config, - ) - { + ) { } } diff --git a/app/Data/Server/Proxmox/ServerStateData.php b/app/Data/Server/Proxmox/ServerStateData.php index a82ab6dc6a8..e95104238ea 100644 --- a/app/Data/Server/Proxmox/ServerStateData.php +++ b/app/Data/Server/Proxmox/ServerStateData.php @@ -2,19 +2,18 @@ namespace Convoy\Data\Server\Proxmox; -use Spatie\LaravelData\Data; use Convoy\Enums\Server\State; +use Spatie\LaravelData\Data; class ServerStateData extends Data { public function __construct( public State $state, public float $cpu_used, - public int $memory_total, - public int $memory_used, - public int $uptime, - ) - { + public int $memory_total, + public int $memory_used, + public int $uptime, + ) { } public static function fromRaw(array $raw) diff --git a/app/Data/Server/Proxmox/Usages/ServerDiskData.php b/app/Data/Server/Proxmox/Usages/ServerDiskData.php index cbf2a638352..350834c0981 100644 --- a/app/Data/Server/Proxmox/Usages/ServerDiskData.php +++ b/app/Data/Server/Proxmox/Usages/ServerDiskData.php @@ -9,7 +9,6 @@ class ServerDiskData extends Data public function __construct( public int $write, public int $read, - ) - { + ) { } } diff --git a/app/Data/Server/Proxmox/Usages/ServerNetworkData.php b/app/Data/Server/Proxmox/Usages/ServerNetworkData.php index 76f1ad80059..ad13c5bdb4d 100644 --- a/app/Data/Server/Proxmox/Usages/ServerNetworkData.php +++ b/app/Data/Server/Proxmox/Usages/ServerNetworkData.php @@ -9,7 +9,6 @@ class ServerNetworkData extends Data public function __construct( public int $in, public int $out, - ) - { + ) { } } diff --git a/app/Data/Server/Proxmox/Usages/ServerTimepointData.php b/app/Data/Server/Proxmox/Usages/ServerTimepointData.php index 13ccca48466..7797b335f3f 100644 --- a/app/Data/Server/Proxmox/Usages/ServerTimepointData.php +++ b/app/Data/Server/Proxmox/Usages/ServerTimepointData.php @@ -8,12 +8,11 @@ class ServerTimepointData extends Data { public function __construct( - public float $cpu_used, - public float $memory_used, + public float $cpu_used, + public float $memory_used, public ServerNetworkData $network, - public ServerDiskData $disk, - public CarbonImmutable $timestamp, - ) - { + public ServerDiskData $disk, + public CarbonImmutable $timestamp, + ) { } } diff --git a/app/Data/Server/Proxmox/Usages/ServerUsagesData.php b/app/Data/Server/Proxmox/Usages/ServerUsagesData.php index 4856372dfad..f25a23f162c 100644 --- a/app/Data/Server/Proxmox/Usages/ServerUsagesData.php +++ b/app/Data/Server/Proxmox/Usages/ServerUsagesData.php @@ -7,10 +7,9 @@ class ServerUsagesData extends Data { public function __construct( - public int $bandwidth, + public int $bandwidth, public ServerNetworkData $network, - public ServerDiskData $disk, - ) - { + public ServerDiskData $disk, + ) { } } diff --git a/app/Events/Activity/Activity.php b/app/Events/Activity/Activity.php index d37958d61ee..fa0cf57c01b 100644 --- a/app/Events/Activity/Activity.php +++ b/app/Events/Activity/Activity.php @@ -2,9 +2,9 @@ namespace Convoy\Events\Activity; -use Illuminate\Support\Str; use Convoy\Models\ActivityLog; use Illuminate\Database\Eloquent\Model; +use Illuminate\Support\Str; abstract class Activity { diff --git a/app/Exceptions/DisplayException.php b/app/Exceptions/DisplayException.php index c833e25e2f2..756c5397f86 100644 --- a/app/Exceptions/DisplayException.php +++ b/app/Exceptions/DisplayException.php @@ -3,14 +3,14 @@ namespace Convoy\Exceptions; use Exception; -use Throwable; -use Psr\Log\LoggerInterface; -use Illuminate\Http\Request; -use Illuminate\Http\Response; -use Illuminate\Http\JsonResponse; use Illuminate\Container\Container; +use Illuminate\Http\JsonResponse; use Illuminate\Http\RedirectResponse; +use Illuminate\Http\Request; +use Illuminate\Http\Response; +use Psr\Log\LoggerInterface; use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; +use Throwable; class DisplayException extends ConvoyException implements HttpExceptionInterface { diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index d610a11bcd0..fc17b5533db 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -3,9 +3,9 @@ namespace Convoy\Exceptions; use Exception; -use Throwable; use Illuminate\Container\Container; use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; +use Throwable; class Handler extends ExceptionHandler { diff --git a/app/Exceptions/Http/Server/ServerStatusConflictException.php b/app/Exceptions/Http/Server/ServerStatusConflictException.php index 44b492aa729..a457c64386b 100644 --- a/app/Exceptions/Http/Server/ServerStatusConflictException.php +++ b/app/Exceptions/Http/Server/ServerStatusConflictException.php @@ -2,9 +2,9 @@ namespace Convoy\Exceptions\Http\Server; -use Throwable; use Convoy\Models\Server; use Symfony\Component\HttpKernel\Exception\ConflictHttpException; +use Throwable; class ServerStatusConflictException extends ConflictHttpException { diff --git a/app/Exceptions/Model/DataValidationException.php b/app/Exceptions/Model/DataValidationException.php index 6b0ffa29e11..9f6f1d76043 100644 --- a/app/Exceptions/Model/DataValidationException.php +++ b/app/Exceptions/Model/DataValidationException.php @@ -2,11 +2,11 @@ namespace Convoy\Exceptions\Model; -use Illuminate\Support\MessageBag; use Convoy\Exceptions\ConvoyException; -use Illuminate\Database\Eloquent\Model; -use Illuminate\Contracts\Validation\Validator; use Illuminate\Contracts\Support\MessageProvider; +use Illuminate\Contracts\Validation\Validator; +use Illuminate\Database\Eloquent\Model; +use Illuminate\Support\MessageBag; use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; class DataValidationException extends ConvoyException implements HttpExceptionInterface, MessageProvider diff --git a/app/Exceptions/Repository/Proxmox/ProxmoxConnectionException.php b/app/Exceptions/Repository/Proxmox/ProxmoxConnectionException.php index 4a21a0e7580..966fe63110c 100644 --- a/app/Exceptions/Repository/Proxmox/ProxmoxConnectionException.php +++ b/app/Exceptions/Repository/Proxmox/ProxmoxConnectionException.php @@ -2,14 +2,14 @@ namespace Convoy\Exceptions\Repository\Proxmox; -use Illuminate\Http\Client\Response; -use Illuminate\Http\Client\RequestException; use Convoy\Exceptions\Repository\RepositoryException; +use Illuminate\Http\Client\RequestException; +use Illuminate\Http\Client\Response; class ProxmoxConnectionException extends RepositoryException { - public function __construct(Response $response, RequestException $exception) - { - parent::__construct($response->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/Service/Api/InvalidJWTException.php b/app/Exceptions/Service/Api/InvalidJWTException.php index 8be4cb88064..e155a40807d 100644 --- a/app/Exceptions/Service/Api/InvalidJWTException.php +++ b/app/Exceptions/Service/Api/InvalidJWTException.php @@ -1,8 +1,9 @@ date = $date ?? CarbonImmutable::now(); } diff --git a/app/Extensions/Spatie/Fractal/RecursiveSerializer.php b/app/Extensions/Spatie/Fractal/RecursiveSerializer.php index 7947d6b915d..d1ade42b690 100644 --- a/app/Extensions/Spatie/Fractal/RecursiveSerializer.php +++ b/app/Extensions/Spatie/Fractal/RecursiveSerializer.php @@ -7,7 +7,7 @@ class RecursiveSerializer extends ArraySerializer { /** - * {@inheritDoc} + * @inheritDoc */ public function collection(?string $resourceKey, array $data): array { @@ -15,7 +15,7 @@ public function collection(?string $resourceKey, array $data): array } /** - * {@inheritDoc} + * @inheritDoc */ public function item(?string $resourceKey, array $data): array { @@ -65,4 +65,4 @@ public function mergeIncludes(array $transformedData, array $includedData): arra return $transformedData; } -} \ No newline at end of file +} diff --git a/app/Facades/Activity.php b/app/Facades/Activity.php index 9e2bc4307d1..4f8f4134c92 100644 --- a/app/Facades/Activity.php +++ b/app/Facades/Activity.php @@ -2,8 +2,8 @@ namespace Convoy\Facades; -use Illuminate\Support\Facades\Facade; use Convoy\Services\Activity\ActivityLogService; +use Illuminate\Support\Facades\Facade; class Activity extends Facade { diff --git a/app/Facades/LogBatch.php b/app/Facades/LogBatch.php index fc4705a686d..e06dbc18ebb 100644 --- a/app/Facades/LogBatch.php +++ b/app/Facades/LogBatch.php @@ -2,8 +2,8 @@ namespace Convoy\Facades; -use Illuminate\Support\Facades\Facade; use Convoy\Services\Activity\ActivityLogBatchService; +use Illuminate\Support\Facades\Facade; class LogBatch extends Facade { diff --git a/app/Facades/LogTarget.php b/app/Facades/LogTarget.php index a5a5a3a1940..a059666712f 100644 --- a/app/Facades/LogTarget.php +++ b/app/Facades/LogTarget.php @@ -2,8 +2,8 @@ namespace Convoy\Facades; -use Illuminate\Support\Facades\Facade; use Convoy\Services\Activity\ActivityLogTargetableService; +use Illuminate\Support\Facades\Facade; class LogTarget extends Facade { diff --git a/app/Helpers/Network.php b/app/Helpers/Network.php index 609e7abee95..025a17e38b6 100644 --- a/app/Helpers/Network.php +++ b/app/Helpers/Network.php @@ -42,4 +42,4 @@ function getAddressesFromRange(AddressType $type, string $from, string $to): arr } return $addresses; -} \ No newline at end of file +} diff --git a/app/Http/Controllers/Admin/AddressPools/AddressController.php b/app/Http/Controllers/Admin/AddressPools/AddressController.php index e2c4f2409e1..889389e06e4 100644 --- a/app/Http/Controllers/Admin/AddressPools/AddressController.php +++ b/app/Http/Controllers/Admin/AddressPools/AddressController.php @@ -23,11 +23,10 @@ class AddressController extends ApiController { public function __construct( - private NetworkService $networkService, - private ConnectionInterface $connection, + private NetworkService $networkService, + private ConnectionInterface $connection, private BulkAddressCreationService $bulkAddressCreationService, - ) - { + ) { } public function index(Request $request, AddressPool $addressPool) @@ -49,8 +48,8 @@ public function index(Request $request, AddressPool $addressPool) ], ) ->paginate(min($request->query('per_page', 50), 100))->appends( - $request->query(), - ); + $request->query(), + ); return fractal($addresses, new AddressTransformer())->parseIncludes($request->include) ->respond(); @@ -72,7 +71,7 @@ public function store(StoreAddressRequest $request, AddressPool $addressPool) macAddress: $data['mac_address'], ); - if (!is_null($request->server_id)) { + if (! is_null($request->server_id)) { SyncNetworkSettings::dispatch($request->integer('server_id')); } @@ -105,8 +104,7 @@ public function store(StoreAddressRequest $request, AddressPool $addressPool) public function update( UpdateAddressRequest $request, AddressPool $addressPool, Address $address, - ) - { + ) { $address = $this->connection->transaction(function () use ($request, $address) { $oldLinkedServer = $address->server; @@ -125,11 +123,11 @@ public function update( $this->networkService->syncSettings($address->server); } } catch (ProxmoxConnectionException) { - if ($oldLinkedServer && !$address->server) { + if ($oldLinkedServer && ! $address->server) { throw new ServiceUnavailableHttpException( message: "Server {$oldLinkedServer->uuid} failed to sync network settings.", ); - } elseif (!$oldLinkedServer && $address->server) { + } elseif (! $oldLinkedServer && $address->server) { throw new ServiceUnavailableHttpException( message: "Server {$address->server->uuid} failed to sync network settings.", ); diff --git a/app/Http/Controllers/Admin/AddressPools/AddressPoolController.php b/app/Http/Controllers/Admin/AddressPools/AddressPoolController.php index 6e79cbdd614..81bb57f58c6 100644 --- a/app/Http/Controllers/Admin/AddressPools/AddressPoolController.php +++ b/app/Http/Controllers/Admin/AddressPools/AddressPoolController.php @@ -28,8 +28,8 @@ public function index(Request $request) )], ) ->paginate(min($request->query('per_page', 50), 100))->appends( - $request->query(), - ); + $request->query(), + ); return fractal($addressPools, new AddressPoolTransformer())->respond(); } @@ -51,8 +51,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..97ebabc25aa 100644 --- a/app/Http/Controllers/Admin/CotermController.php +++ b/app/Http/Controllers/Admin/CotermController.php @@ -35,8 +35,8 @@ public function index(Request $request) )], ) ->paginate(min($request->query('per_page', 50), 100))->appends( - $request->query(), - ); + $request->query(), + ); return fractal($addressPools, new CotermTransformer())->respond(); } @@ -91,8 +91,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..bfb17ac28f3 100644 --- a/app/Http/Controllers/Admin/LocationController.php +++ b/app/Http/Controllers/Admin/LocationController.php @@ -21,11 +21,11 @@ public function index(Request $request) ->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..f3e6600cb63 100644 --- a/app/Http/Controllers/Admin/Nodes/AddressController.php +++ b/app/Http/Controllers/Admin/Nodes/AddressController.php @@ -26,8 +26,8 @@ public function index(Request $request, Node $node) ), AllowedFilter::exact('server_id')->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..7f56d30a426 100644 --- a/app/Http/Controllers/Admin/Nodes/IsoController.php +++ b/app/Http/Controllers/Admin/Nodes/IsoController.php @@ -21,8 +21,7 @@ class IsoController extends ApiController { public function __construct( private IsoService $isoService, private ProxmoxStorageRepository $repository, - ) - { + ) { } public function index(Node $node, Request $request) @@ -31,8 +30,8 @@ public function index(Node $node, Request $request) ->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(); } @@ -42,7 +41,7 @@ public function store(StoreIsoRequest $request, Node $node) $shouldDownload = $request->boolean('should_download'); if ($shouldDownload) { - $checksumData = (bool)$request->checksum_algorithum ? ChecksumData::from([ + $checksumData = (bool) $request->checksum_algorithum ? ChecksumData::from([ 'algorithm' => ChecksumAlgorithm::from($request->checksum_algorithum), 'checksum' => $request->checksum, ]) : null; diff --git a/app/Http/Controllers/Admin/Nodes/NodeController.php b/app/Http/Controllers/Admin/Nodes/NodeController.php index 7b3ade1e4fd..d681867fedf 100644 --- a/app/Http/Controllers/Admin/Nodes/NodeController.php +++ b/app/Http/Controllers/Admin/Nodes/NodeController.php @@ -30,8 +30,8 @@ public function index(Request $request) )], ) ->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..824e26fd85c 100644 --- a/app/Http/Controllers/Admin/Nodes/TemplateController.php +++ b/app/Http/Controllers/Admin/Nodes/TemplateController.php @@ -37,8 +37,7 @@ public function store(TemplateRequest $request, Node $node, TemplateGroup $templ public function update( TemplateRequest $request, Node $node, TemplateGroup $templateGroup, Template $template, - ) - { + ) { $template->update($request->validated()); return fractal($template, new TemplateTransformer())->respond(); @@ -53,8 +52,7 @@ public function destroy(Node $node, TemplateGroup $templateGroup, Template $temp public function updateOrder( UpdateTemplateOrderRequest $request, Node $node, TemplateGroup $templateGroup, - ) - { + ) { Template::setNewOrder($request->order); return fractal( diff --git a/app/Http/Controllers/Admin/ServerController.php b/app/Http/Controllers/Admin/ServerController.php index 354268d34df..01cd9112435 100644 --- a/app/Http/Controllers/Admin/ServerController.php +++ b/app/Http/Controllers/Admin/ServerController.php @@ -28,15 +28,14 @@ class ServerController extends ApiController { public function __construct( - private ConnectionInterface $connection, - private ServerDeletionService $deletionService, - private NetworkService $networkService, + private ConnectionInterface $connection, + private ServerDeletionService $deletionService, + private NetworkService $networkService, private ServerSuspensionService $suspensionService, - private ServerCreationService $creationService, - private CloudinitService $cloudinitService, - private SyncBuildService $buildModificationService, - ) - { + private ServerCreationService $creationService, + private CloudinitService $cloudinitService, + private SyncBuildService $buildModificationService, + ) { } public function index(Request $request) @@ -59,8 +58,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(); @@ -87,7 +86,7 @@ public function store(StoreServerRequest $request) public function update(UpdateGeneralInfoRequest $request, Server $server) { $this->connection->transaction(function () use ($request, $server) { - if ($request->hostname !== $server->hostname && !empty($request->hostname)) { + if ($request->hostname !== $server->hostname && ! empty($request->hostname)) { try { $this->cloudinitService->updateHostname($server, $request->hostname); } catch (ProxmoxConnectionException) { diff --git a/app/Http/Controllers/Admin/TokenController.php b/app/Http/Controllers/Admin/TokenController.php index 14e83dee5ab..97a27d8c1b1 100644 --- a/app/Http/Controllers/Admin/TokenController.php +++ b/app/Http/Controllers/Admin/TokenController.php @@ -20,8 +20,8 @@ public function index(Request $request) ->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..c5461ebc405 100644 --- a/app/Http/Controllers/Admin/UserController.php +++ b/app/Http/Controllers/Admin/UserController.php @@ -34,8 +34,8 @@ public function index(Request $request) ), AllowedFilter::custom('*', new FiltersUserWildcard())], ) ->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/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index 905cdc9c9d6..c6a7c1f543a 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -35,7 +35,7 @@ public function authorizeToken(Request $request) /** @var User $user */ $user = User::where('uuid', '=', $token->claims()->get('user_uuid'))->first(); - if (!$user) { + if (! $user) { throw new UnauthorizedHttpException('', 'Invalid JWT claims'); } diff --git a/app/Http/Controllers/Base/IndexController.php b/app/Http/Controllers/Base/IndexController.php index b51506114ea..f54ea07ac3a 100644 --- a/app/Http/Controllers/Base/IndexController.php +++ b/app/Http/Controllers/Base/IndexController.php @@ -13,8 +13,7 @@ class IndexController extends Controller */ public function __construct( protected ViewFactory $view, - ) - { + ) { } /** diff --git a/app/Http/Controllers/Client/Servers/BackupController.php b/app/Http/Controllers/Client/Servers/BackupController.php index a295246c176..7b32c5932b2 100644 --- a/app/Http/Controllers/Client/Servers/BackupController.php +++ b/app/Http/Controllers/Client/Servers/BackupController.php @@ -21,12 +21,11 @@ class BackupController extends ApiController { public function __construct( - private BackupCreationService $backupCreationService, - private BackupDeletionService $backupDeletionService, + private BackupCreationService $backupCreationService, + private BackupDeletionService $backupDeletionService, private RestoreFromBackupService $restoreFromBackupService, - private BackupRepository $backupRepository, - ) - { + private BackupRepository $backupRepository, + ) { } public function index(Request $request, Server $server) diff --git a/app/Http/Controllers/Client/Servers/ServerController.php b/app/Http/Controllers/Client/Servers/ServerController.php index 457ba686cda..827fa7982cf 100644 --- a/app/Http/Controllers/Client/Servers/ServerController.php +++ b/app/Http/Controllers/Client/Servers/ServerController.php @@ -18,22 +18,21 @@ use Convoy\Transformers\Client\ServerStateTransformer; use Convoy\Transformers\Client\ServerTerminalTransformer; use Convoy\Transformers\Client\ServerTransformer; +use function fractal; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; -use Spatie\QueryBuilder\QueryBuilder; -use function fractal; use function min; +use Spatie\QueryBuilder\QueryBuilder; class ServerController extends ApiController { public function __construct( - private CotermJWTService $cotermJWTService, - private ServerConsoleService $consoleService, - private ServerDetailService $detailService, + private CotermJWTService $cotermJWTService, + private ServerConsoleService $consoleService, + private ServerDetailService $detailService, private ProxmoxServerRepository $serverRepository, - private ProxmoxPowerRepository $powerRepository, - ) - { + private ProxmoxPowerRepository $powerRepository, + ) { } public function index(Request $request) diff --git a/app/Http/Controllers/Client/Servers/SettingsController.php b/app/Http/Controllers/Client/Servers/SettingsController.php index f97fdd549ac..a198efddd01 100644 --- a/app/Http/Controllers/Client/Servers/SettingsController.php +++ b/app/Http/Controllers/Client/Servers/SettingsController.php @@ -34,13 +34,12 @@ class SettingsController extends ApiController { public function __construct( - private ServerAuthService $authService, - private ConnectionInterface $connection, - private CloudinitService $cloudinitService, + private ServerAuthService $authService, + private ConnectionInterface $connection, + private CloudinitService $cloudinitService, private ServerBuildDispatchService $buildDispatchService, - private AllocationService $allocationService, - ) - { + private AllocationService $allocationService, + ) { } public function rename(RenameServerRequest $request, Server $server) @@ -60,7 +59,7 @@ public function getTemplateGroups(Request $request, Server $server) ->defaultSort('order_column') ->allowedFilters(['name']); - if (!$request->user()->root_admin) { + if (! $request->user()->root_admin) { $templateGroups = $templateGroups->where( [['template_groups.hidden', '=', false], ['template_groups.node_id', '=', $server->node->id]], ) diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index fb51691f102..6b97525e4e7 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -6,7 +6,7 @@ use Illuminate\Foundation\Validation\ValidatesRequests; use Illuminate\Routing\Controller as BaseController; -class Controller extends BaseController +abstract class Controller extends BaseController { use AuthorizesRequests, ValidatesRequests; } diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php deleted file mode 100644 index 7e3bfcb0834..00000000000 --- a/app/Http/Kernel.php +++ /dev/null @@ -1,89 +0,0 @@ - - */ - protected $middleware = [ - // \Convoy\Http\Middleware\TrustHosts::class, - TrustProxies::class, - HandleCors::class, - PreventRequestsDuringMaintenance::class, - ValidatePostSize::class, - TrimStrings::class, - ConvertEmptyStringsToNull::class, - ]; - - /** - * The application's route middleware groups. - * - * @var array> - */ - protected $middlewareGroups = [ - 'web' => [ - EncryptCookies::class, - AddQueuedCookiesToResponse::class, - StartSession::class, - ShareErrorsFromSession::class, - VerifyCsrfToken::class, - SubstituteBindings::class, - ], - - 'api' => [ - // \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class, - // \Illuminate\Routing\Middleware\ThrottleRequests::class . ':api', - SubstituteBindings::class, - ], - ]; - - /** - * The application's middleware aliases. - * - * Aliases may be used to conveniently assign middleware to routes and groups. - * - * @var array - */ - protected $middlewareAliases = [ - 'auth' => Authenticate::class, - 'auth.basic' => AuthenticateWithBasicAuth::class, - 'auth.session' => AuthenticateSession::class, - 'cache.headers' => SetCacheHeaders::class, - 'can' => Authorize::class, - 'guest' => RedirectIfAuthenticated::class, - 'password.confirm' => RequirePassword::class, - 'signed' => ValidateSignature::class, - 'throttle' => ThrottleRequests::class, - 'verified' => EnsureEmailIsVerified::class, - ]; -} diff --git a/app/Http/Middleware/Admin/Server/ValidateServerStatusMiddleware.php b/app/Http/Middleware/Admin/Server/ValidateServerStatusMiddleware.php index f30cc6f0a5e..7975ba1e274 100644 --- a/app/Http/Middleware/Admin/Server/ValidateServerStatusMiddleware.php +++ b/app/Http/Middleware/Admin/Server/ValidateServerStatusMiddleware.php @@ -16,7 +16,7 @@ public function handle(Request $request, Closure $next): Response { $server = $request->route()->parameter('server'); - if (!$server instanceof Server) { + if (! $server instanceof Server) { throw new NotFoundHttpException('Server not found'); } diff --git a/app/Http/Middleware/AdminAuthenticate.php b/app/Http/Middleware/AdminAuthenticate.php index c351eae9d34..f004ea31757 100644 --- a/app/Http/Middleware/AdminAuthenticate.php +++ b/app/Http/Middleware/AdminAuthenticate.php @@ -17,7 +17,7 @@ class AdminAuthenticate */ public function handle(Request $request, Closure $next): Response { - if (!$request->user() || !$request->user()->root_admin) { + if (! $request->user() || ! $request->user()->root_admin) { throw new AccessDeniedHttpException(); } diff --git a/app/Http/Middleware/Client/Server/AuthenticateServerAccess.php b/app/Http/Middleware/Client/Server/AuthenticateServerAccess.php index 79d6416d16a..6855f5246e0 100644 --- a/app/Http/Middleware/Client/Server/AuthenticateServerAccess.php +++ b/app/Http/Middleware/Client/Server/AuthenticateServerAccess.php @@ -24,11 +24,11 @@ public function handle(Request $request, Closure $next): Response $user = $request->user(); $server = $request->route()->parameter('server'); - if (!$server instanceof Server) { + if (! $server instanceof Server) { throw new NotFoundHttpException('Server not found'); } - if ($user->id !== $server->user_id && !$user->root_admin) { + if ($user->id !== $server->user_id && ! $user->root_admin) { throw new NotFoundHttpException('Server not found'); } diff --git a/app/Http/Middleware/Client/Server/ServerInstalled.php b/app/Http/Middleware/Client/Server/ServerInstalled.php index 9b5d944efff..7ce34f0d252 100644 --- a/app/Http/Middleware/Client/Server/ServerInstalled.php +++ b/app/Http/Middleware/Client/Server/ServerInstalled.php @@ -15,18 +15,17 @@ class ServerInstalled * Checks that the server is installed before allowing access through the route. */ public function handle(Request $request, Closure $next, - ): \Symfony\Component\HttpFoundation\Response - { + ): \Symfony\Component\HttpFoundation\Response { /** @var Server|null $server */ $server = $request->route()->parameter('server'); - if (!$server instanceof Server) { + if (! $server instanceof Server) { throw new NotFoundHttpException( 'No server resource was located in the request parameters.', ); } - if (!$server->isInstalled()) { + if (! $server->isInstalled()) { throw new HttpException( Response::HTTP_FORBIDDEN, 'Access to this resource is not allowed due to the current installation state.', diff --git a/app/Http/Middleware/Client/Server/ServerNotInstalled.php b/app/Http/Middleware/Client/Server/ServerNotInstalled.php index eff3d948c6b..f359673efee 100644 --- a/app/Http/Middleware/Client/Server/ServerNotInstalled.php +++ b/app/Http/Middleware/Client/Server/ServerNotInstalled.php @@ -15,18 +15,17 @@ class ServerNotInstalled * Checks that the server is installed before allowing access through the route. */ public function handle(Request $request, Closure $next, - ): \Symfony\Component\HttpFoundation\Response - { + ): \Symfony\Component\HttpFoundation\Response { /** @var Server|null $server */ $server = $request->route()->parameter('server'); - if (!$server instanceof Server) { + if (! $server instanceof Server) { throw new NotFoundHttpException( 'No server resource was located in the request parameters.', ); } - if (!$server->isInstalled()) { + if (! $server->isInstalled()) { throw new HttpException( Response::HTTP_FORBIDDEN, 'Access to this resource is not allowed due to the current non-installation state.', diff --git a/app/Http/Middleware/Coterm/CotermAuthenticate.php b/app/Http/Middleware/Coterm/CotermAuthenticate.php index 263bb3629f2..a0b80d87eb3 100644 --- a/app/Http/Middleware/Coterm/CotermAuthenticate.php +++ b/app/Http/Middleware/Coterm/CotermAuthenticate.php @@ -18,7 +18,7 @@ class CotermAuthenticate /** * Check if a request from the daemon can be properly attributed back to a single node instance. * - * @throws \Symfony\Component\HttpKernel\Exception\HttpException + * @throws HttpException */ public function handle(Request $request, \Closure $next): mixed { diff --git a/app/Http/Middleware/EncryptCookies.php b/app/Http/Middleware/EncryptCookies.php deleted file mode 100644 index 9012214d711..00000000000 --- a/app/Http/Middleware/EncryptCookies.php +++ /dev/null @@ -1,17 +0,0 @@ - - */ - protected $except = [ - // - ]; -} diff --git a/app/Http/Middleware/ForceJsonResponse.php b/app/Http/Middleware/ForceJsonResponse.php index babcec43829..e5147497da8 100644 --- a/app/Http/Middleware/ForceJsonResponse.php +++ b/app/Http/Middleware/ForceJsonResponse.php @@ -13,8 +13,7 @@ class ForceJsonResponse * @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next */ public function handle(Request $request, Closure $next, - ): \Symfony\Component\HttpFoundation\Response - { + ): \Symfony\Component\HttpFoundation\Response { $request->headers->set('Accept', 'application/json'); return $next($request); diff --git a/app/Http/Middleware/PreventRequestsDuringMaintenance.php b/app/Http/Middleware/PreventRequestsDuringMaintenance.php deleted file mode 100644 index a0af8cb7626..00000000000 --- a/app/Http/Middleware/PreventRequestsDuringMaintenance.php +++ /dev/null @@ -1,17 +0,0 @@ - - */ - protected $except = [ - // - ]; -} diff --git a/app/Http/Middleware/RedirectIfAuthenticated.php b/app/Http/Middleware/RedirectIfAuthenticated.php deleted file mode 100644 index 6c146dbed93..00000000000 --- a/app/Http/Middleware/RedirectIfAuthenticated.php +++ /dev/null @@ -1,30 +0,0 @@ -check()) { - return redirect(RouteServiceProvider::HOME); - } - } - - return $next($request); - } -} diff --git a/app/Http/Middleware/TrimStrings.php b/app/Http/Middleware/TrimStrings.php deleted file mode 100644 index 0bff561c169..00000000000 --- a/app/Http/Middleware/TrimStrings.php +++ /dev/null @@ -1,19 +0,0 @@ - - */ - protected $except = [ - 'current_password', - 'password', - 'password_confirmation', - ]; -} diff --git a/app/Http/Middleware/TrustHosts.php b/app/Http/Middleware/TrustHosts.php deleted file mode 100644 index a48213a3a2e..00000000000 --- a/app/Http/Middleware/TrustHosts.php +++ /dev/null @@ -1,20 +0,0 @@ - - */ - public function hosts(): array - { - return [ - $this->allSubdomainsOfApplicationUrl(), - ]; - } -} diff --git a/app/Http/Middleware/TrustProxies.php b/app/Http/Middleware/TrustProxies.php deleted file mode 100644 index 2adc8f2c5fa..00000000000 --- a/app/Http/Middleware/TrustProxies.php +++ /dev/null @@ -1,28 +0,0 @@ -|string|null - */ - protected $proxies; - - /** - * The headers that should be used to detect proxies. - * - * @var int - */ - protected $headers = - Request::HEADER_X_FORWARDED_FOR | - Request::HEADER_X_FORWARDED_HOST | - Request::HEADER_X_FORWARDED_PORT | - Request::HEADER_X_FORWARDED_PROTO | - Request::HEADER_X_FORWARDED_AWS_ELB; -} diff --git a/app/Http/Middleware/ValidateSignature.php b/app/Http/Middleware/ValidateSignature.php deleted file mode 100644 index 4da625ed019..00000000000 --- a/app/Http/Middleware/ValidateSignature.php +++ /dev/null @@ -1,22 +0,0 @@ - - */ - protected $except = [ - // 'fbclid', - // 'utm_campaign', - // 'utm_content', - // 'utm_medium', - // 'utm_source', - // 'utm_term', - ]; -} diff --git a/app/Http/Middleware/VerifyCsrfToken.php b/app/Http/Middleware/VerifyCsrfToken.php deleted file mode 100644 index fce35f05ea0..00000000000 --- a/app/Http/Middleware/VerifyCsrfToken.php +++ /dev/null @@ -1,17 +0,0 @@ - - */ - protected $except = [ - // - ]; -} diff --git a/app/Http/Requests/Admin/AddressPools/Addresses/StoreAddressRequest.php b/app/Http/Requests/Admin/AddressPools/Addresses/StoreAddressRequest.php index 7bc0a2527b0..ab099498007 100644 --- a/app/Http/Requests/Admin/AddressPools/Addresses/StoreAddressRequest.php +++ b/app/Http/Requests/Admin/AddressPools/Addresses/StoreAddressRequest.php @@ -36,7 +36,7 @@ public function after(): array ); } - if (!$this->boolean('is_bulk_action')) { + if (! $this->boolean('is_bulk_action')) { $pool = $this->parameter('address_pool', AddressPool::class); $rules[] = new ValidateAddressType( $this->enum('type', AddressType::class), ['address', 'gateway'], @@ -62,7 +62,7 @@ protected function passedValidation(): void ]); } - if (!is_null($this->mac_address)) { + if (! is_null($this->mac_address)) { $this->replace([ 'mac_address' => strtolower($this->string('mac_address')), ]); diff --git a/app/Http/Requests/Admin/AddressPools/StoreAddressPoolRequest.php b/app/Http/Requests/Admin/AddressPools/StoreAddressPoolRequest.php index 72eb6c1f860..25e047afd40 100644 --- a/app/Http/Requests/Admin/AddressPools/StoreAddressPoolRequest.php +++ b/app/Http/Requests/Admin/AddressPools/StoreAddressPoolRequest.php @@ -10,6 +10,7 @@ class StoreAddressPoolRequest extends FormRequest public function rules(): array { $rules = AddressPool::getRules(); + return [ ...$rules, 'node_ids' => 'sometimes|array', diff --git a/app/Http/Requests/Admin/Nodes/Isos/StoreIsoRequest.php b/app/Http/Requests/Admin/Nodes/Isos/StoreIsoRequest.php index 90b97ac86dd..3cf11f2526a 100644 --- a/app/Http/Requests/Admin/Nodes/Isos/StoreIsoRequest.php +++ b/app/Http/Requests/Admin/Nodes/Isos/StoreIsoRequest.php @@ -43,7 +43,7 @@ function (Validator $validator) { }, ]; - if (!$this->boolean('should_download')) { + if (! $this->boolean('should_download')) { $rules[] = function (Validator $validator) { $node = $this->parameter('node', Node::class); diff --git a/app/Http/Requests/Admin/Nodes/Isos/UpdateIsoRequest.php b/app/Http/Requests/Admin/Nodes/Isos/UpdateIsoRequest.php index 225859c1b59..198fcfd66fa 100644 --- a/app/Http/Requests/Admin/Nodes/Isos/UpdateIsoRequest.php +++ b/app/Http/Requests/Admin/Nodes/Isos/UpdateIsoRequest.php @@ -16,5 +16,4 @@ public function rules(): array 'hidden' => $rules['hidden'], ]; } - } diff --git a/app/Http/Requests/Admin/Nodes/UpdateNodeRequest.php b/app/Http/Requests/Admin/Nodes/UpdateNodeRequest.php index 5132f9e6e3c..a1ab74d64f9 100644 --- a/app/Http/Requests/Admin/Nodes/UpdateNodeRequest.php +++ b/app/Http/Requests/Admin/Nodes/UpdateNodeRequest.php @@ -26,11 +26,11 @@ public function withValidator(Validator $validator): void $node = $this->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( diff --git a/app/Http/Requests/Admin/Servers/Settings/UpdateDetailsRequest.php b/app/Http/Requests/Admin/Servers/Settings/UpdateDetailsRequest.php index 0886bb66f31..330b542a9a4 100644 --- a/app/Http/Requests/Admin/Servers/Settings/UpdateDetailsRequest.php +++ b/app/Http/Requests/Admin/Servers/Settings/UpdateDetailsRequest.php @@ -42,7 +42,7 @@ public function validated($key = null, $default = null): array $data = parent::validated(); // Adjust the limits field to match what is expected by the model. - if (!empty($data['limits'])) { + if (! empty($data['limits'])) { foreach ($data['limits'] as $key => $value) { $data[$key] = $value; } diff --git a/app/Http/Requests/Admin/Servers/StoreServerRequest.php b/app/Http/Requests/Admin/Servers/StoreServerRequest.php index 487a7421269..bcc664380dd 100644 --- a/app/Http/Requests/Admin/Servers/StoreServerRequest.php +++ b/app/Http/Requests/Admin/Servers/StoreServerRequest.php @@ -48,7 +48,7 @@ public function withValidator(Validator $validator): void $validator->after(function ($validator) { $addressIds = $this->input('limits.address_ids'); - if (!is_null($addressIds)) { + if (! is_null($addressIds)) { $addresses = Address::whereIn('id', $addressIds)->get(); foreach ($addresses as $address) { diff --git a/app/Http/Requests/Auth/LoginRequest.php b/app/Http/Requests/Auth/LoginRequest.php index 5baec1a5de1..2edae1c7d47 100644 --- a/app/Http/Requests/Auth/LoginRequest.php +++ b/app/Http/Requests/Auth/LoginRequest.php @@ -40,7 +40,7 @@ public function authenticate(): void { $this->ensureIsNotRateLimited(); - if (!Auth::attempt($this->only('email', 'password'), $this->boolean('remember'))) { + if (! Auth::attempt($this->only('email', 'password'), $this->boolean('remember'))) { RateLimiter::hit($this->throttleKey()); throw ValidationException::withMessages([ @@ -59,7 +59,7 @@ public function authenticate(): void */ public function ensureIsNotRateLimited(): void { - if (!RateLimiter::tooManyAttempts($this->throttleKey(), 5)) { + if (! RateLimiter::tooManyAttempts($this->throttleKey(), 5)) { return; } @@ -80,6 +80,6 @@ public function ensureIsNotRateLimited(): void */ public function throttleKey(): string { - return Str::lower($this->input('email')) . '|' . $this->ip(); + return Str::lower($this->input('email')).'|'.$this->ip(); } } diff --git a/app/Http/Requests/BaseApiRequest.php b/app/Http/Requests/BaseApiRequest.php index 0af903988d0..ba3293dbd4a 100644 --- a/app/Http/Requests/BaseApiRequest.php +++ b/app/Http/Requests/BaseApiRequest.php @@ -29,7 +29,7 @@ public function authorize(): bool */ protected function prepareForValidation(): void { - if (!$this->passesAuthorization()) { + if (! $this->passesAuthorization()) { $this->failedAuthorization(); } @@ -54,7 +54,7 @@ protected function passesAuthorization(): bool return true; } - if (!parent::passesAuthorization()) { + if (! parent::passesAuthorization()) { return false; } diff --git a/app/Http/Requests/Client/Servers/Settings/MountMediaRequest.php b/app/Http/Requests/Client/Servers/Settings/MountMediaRequest.php index 6311df522c3..d710df9b767 100644 --- a/app/Http/Requests/Client/Servers/Settings/MountMediaRequest.php +++ b/app/Http/Requests/Client/Servers/Settings/MountMediaRequest.php @@ -12,7 +12,7 @@ public function authorize(): bool $iso = $this->parameter('iso', ISO::class); // check if they're authorized to mount a hidden media (iso) - if ($iso->hidden && !$this->user()->root_admin) { + if ($iso->hidden && ! $this->user()->root_admin) { return false; } diff --git a/app/Jobs/Server/MonitorStateJob.php b/app/Jobs/Server/MonitorStateJob.php index 9375cc992d0..c4794d76d2c 100644 --- a/app/Jobs/Server/MonitorStateJob.php +++ b/app/Jobs/Server/MonitorStateJob.php @@ -25,11 +25,10 @@ public function retryUntil(): Carbon } public function __construct( - protected int $serverId, - protected State $targetState, + protected int $serverId, + protected State $targetState, protected ?Closure $callback = null, - ) - { + ) { // } diff --git a/app/Jobs/Server/WaitUntilVmIsCreatedJob.php b/app/Jobs/Server/WaitUntilVmIsCreatedJob.php index 9f6d81076bf..11680647c36 100644 --- a/app/Jobs/Server/WaitUntilVmIsCreatedJob.php +++ b/app/Jobs/Server/WaitUntilVmIsCreatedJob.php @@ -37,7 +37,7 @@ public function handle(ServerBuildService $service): void $isCreated = $service->isVmCreated($server); - if (!$isCreated) { + if (! $isCreated) { $this->release(3); } } diff --git a/app/Jobs/Server/WaitUntilVmIsDeletedJob.php b/app/Jobs/Server/WaitUntilVmIsDeletedJob.php index d8e3a890ebb..11524c4c91e 100644 --- a/app/Jobs/Server/WaitUntilVmIsDeletedJob.php +++ b/app/Jobs/Server/WaitUntilVmIsDeletedJob.php @@ -37,7 +37,7 @@ public function handle(ServerBuildService $service): void $isDeleted = $service->isVmDeleted($server); - if (!$isDeleted) { + if (! $isDeleted) { $this->release(3); } } diff --git a/app/Models/ActivityLog.php b/app/Models/ActivityLog.php index 591b1b0aefb..5df54e76267 100644 --- a/app/Models/ActivityLog.php +++ b/app/Models/ActivityLog.php @@ -18,11 +18,6 @@ class ActivityLog extends Model 'timestamp', ]; - protected $casts = [ - 'properties' => 'collection', - 'timestamp' => 'datetime', - ]; - protected $with = ['subjects']; public static array $validationRules = [ @@ -33,6 +28,14 @@ class ActivityLog extends Model 'properties' => ['array'], ]; + protected function casts(): array + { + return [ + 'properties' => 'collection', + 'timestamp' => 'datetime', + ]; + } + public function actor(): MorphTo { $morph = $this->morphTo(); @@ -66,7 +69,7 @@ public function scopeForActor(Builder $builder, Model $actor): Builder * * @see https://laravel.com/docs/9.x/eloquent#pruning-models */ - public function prunable(): ActivityLog + public function prunable(): self { if (is_null(config('activity.prune_days'))) { throw new LogicException( diff --git a/app/Models/Address.php b/app/Models/Address.php index 1fda6c7874c..62f9c10e930 100644 --- a/app/Models/Address.php +++ b/app/Models/Address.php @@ -8,7 +8,7 @@ class Address extends Model { use HasFactory; - + protected $table = 'ip_addresses'; protected $guarded = ['id', 'updated_at', 'created_at']; diff --git a/app/Models/Backup.php b/app/Models/Backup.php index 8a9dfe65d54..d6fd2df0b18 100644 --- a/app/Models/Backup.php +++ b/app/Models/Backup.php @@ -14,11 +14,6 @@ class Backup extends Model protected $guarded = ['id', 'created_at', 'updated_at']; - protected $casts = [ - 'completed_at' => 'datetime', - 'size' => StorageSizeCast::class, - ]; - public static array $validationRules = [ 'uuid' => 'required|uuid', 'server_id' => 'required|exists:servers,id', @@ -30,6 +25,14 @@ class Backup extends Model 'completed_at' => 'nullable|date', ]; + protected function casts(): array + { + return [ + 'completed_at' => 'datetime', + 'size' => StorageSizeCast::class, + ]; + } + public function server(): BelongsTo { return $this->belongsTo(Server::class); diff --git a/app/Models/Coterm.php b/app/Models/Coterm.php index 968ca027db1..33d68544f60 100644 --- a/app/Models/Coterm.php +++ b/app/Models/Coterm.php @@ -7,13 +7,13 @@ class Coterm extends Model { - /** * The constants for generating Coterm secret keys */ public const COTERM_TOKEN_ID_LENGTH = 16; + public const COTERM_TOKEN_LENGTH = 64; - + protected $guarded = [ 'id', 'created_at', @@ -24,11 +24,6 @@ class Coterm extends Model 'token_id', 'token', ]; - protected $casts = [ - 'is_tls_enabled' => 'boolean', - 'coterm_token' => NullableEncrypter::class, - ]; - public static array $validationRules = [ 'name' => 'required|string|max:191', 'is_tls_enabled' => 'required|boolean', @@ -38,6 +33,14 @@ class Coterm extends Model 'token' => 'required|string|max:191', ]; + protected function casts(): array + { + return [ + 'is_tls_enabled' => 'boolean', + 'coterm_token' => NullableEncrypter::class, + ]; + } + public function nodes(): HasMany { return $this->hasMany(Node::class); diff --git a/app/Models/Deployment.php b/app/Models/Deployment.php index ee41d076204..d31b74462ae 100644 --- a/app/Models/Deployment.php +++ b/app/Models/Deployment.php @@ -2,7 +2,6 @@ namespace Convoy\Models; - use Illuminate\Database\Eloquent\Relations\BelongsTo; class Deployment extends Model diff --git a/app/Models/Filters/FiltersAddressByNodeId.php b/app/Models/Filters/FiltersAddressByNodeId.php index 659d2a6bfac..8ed8159cdaa 100644 --- a/app/Models/Filters/FiltersAddressByNodeId.php +++ b/app/Models/Filters/FiltersAddressByNodeId.php @@ -10,14 +10,14 @@ class FiltersAddressByNodeId implements Filter public function __invoke(Builder $query, $value, string $property): void { $query->whereRaw( - " + ' address_pool_id IN ( SELECT apn.address_pool_id FROM address_pool_to_node apn WHERE apn.node_id = ? ) - ", + ', [$value], ); } -} \ No newline at end of file +} diff --git a/app/Models/Filters/FiltersCotermWildcard.php b/app/Models/Filters/FiltersCotermWildcard.php index 72dfce03ac0..3710863ffd1 100644 --- a/app/Models/Filters/FiltersCotermWildcard.php +++ b/app/Models/Filters/FiltersCotermWildcard.php @@ -12,4 +12,4 @@ public function __invoke(Builder $query, $value, string $property): void $query->where('id', $value) ->orWhereRaw('LOWER(name) LIKE ?', ["%$value%"]); } -} \ No newline at end of file +} diff --git a/app/Models/Filters/FiltersServerByAddressPoolId.php b/app/Models/Filters/FiltersServerByAddressPoolId.php index 9bdf5975f38..0afde9dcf71 100644 --- a/app/Models/Filters/FiltersServerByAddressPoolId.php +++ b/app/Models/Filters/FiltersServerByAddressPoolId.php @@ -10,15 +10,15 @@ class FiltersServerByAddressPoolId implements Filter public function __invoke(Builder $query, $value, string $property): void { $query->whereRaw( - " + ' id IN ( SELECT serv.id FROM servers serv JOIN address_pool_to_node apn ON serv.node_id = apn.node_id WHERE apn.address_pool_id = ? ) - ", + ', [$value], ); } -} \ No newline at end of file +} diff --git a/app/Models/ISO.php b/app/Models/ISO.php index 396a8abe744..c94b9b3efbf 100644 --- a/app/Models/ISO.php +++ b/app/Models/ISO.php @@ -15,12 +15,6 @@ class ISO extends Model protected $guarded = ['id', 'created_at', 'updated_at']; - protected $casts = [ - 'is_successful' => 'boolean', - 'size' => StorageSizeCast::class, - 'hidden' => 'boolean', - ]; - public static array $validationRules = [ 'node_id' => 'required|integer|exists:nodes,id', 'is_successful' => 'sometimes|boolean', @@ -31,6 +25,15 @@ class ISO extends Model 'completed_at' => 'nullable|date', ]; + protected function casts(): array + { + return [ + 'is_successful' => 'boolean', + 'size' => StorageSizeCast::class, + 'hidden' => 'boolean', + ]; + } + public function node(): BelongsTo { return $this->belongsTo(Node::class); diff --git a/app/Models/Model.php b/app/Models/Model.php index 0b826d06ed7..ade45f5d0a9 100644 --- a/app/Models/Model.php +++ b/app/Models/Model.php @@ -120,9 +120,8 @@ public static function getRulesForField(string $field): array */ public static function getRulesForUpdate( IlluminateModel|int|string $model, string $column = 'id', - ): array - { - if ($model instanceof Model) { + ): array { + if ($model instanceof self) { [$id, $column] = [$model->getKey(), $model->getKeyName()]; } @@ -133,7 +132,7 @@ public static function getRulesForUpdate( // working model, so we don't run into errors due to the way that field validation // works. foreach ($data as &$datum) { - if (!is_string($datum) || !Str::startsWith($datum, 'unique')) { + if (! is_string($datum) || ! Str::startsWith($datum, 'unique')) { continue; } @@ -158,16 +157,16 @@ 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(), ), ); - if (!$validator->passes()) { + if (! $validator->passes()) { throw new ValidationException($validator); } } @@ -177,7 +176,7 @@ public function validate(): void */ protected function asDateTime(mixed $value): Carbon|CarbonImmutable { - if (!$this->immutableDates) { + if (! $this->immutableDates) { return parent::asDateTime($value); } diff --git a/app/Models/Node.php b/app/Models/Node.php index 2e3bb34d9fe..4ddd1707bb5 100644 --- a/app/Models/Node.php +++ b/app/Models/Node.php @@ -21,16 +21,6 @@ class Node extends Model 'secret', ]; - /** - * Cast values to correct type. - */ - protected $casts = [ - 'verify_tls' => 'boolean', - 'memory' => StorageSizeCast::class, - 'disk' => StorageSizeCast::class, - 'secret' => 'encrypted', - ]; - /** * Fields that aren't mass assignable */ @@ -51,6 +41,21 @@ class Node extends Model 'coterm_id' => 'sometimes|nullable|integer|exists:coterms,id', ]; + /** + * Get the attributes that should be cast. + * + * @return array + */ + protected function casts(): array + { + return [ + 'verify_tls' => 'boolean', + 'memory' => StorageSizeCast::class, + 'disk' => StorageSizeCast::class, + 'secret' => 'encrypted', + ]; + } + /** * Get the connection address to use when making calls to this node's assigned Coterm endpoint. */ diff --git a/app/Models/PersonalAccessToken.php b/app/Models/PersonalAccessToken.php index 3dee51a0d4b..ea598442494 100644 --- a/app/Models/PersonalAccessToken.php +++ b/app/Models/PersonalAccessToken.php @@ -17,9 +17,12 @@ class PersonalAccessToken extends SanctumPersonalAccessToken 'abilities', ]; - protected $casts = [ - 'type' => ApiKeyType::class, - 'abilities' => 'json', - 'last_used_at' => 'datetime', - ]; + protected function casts(): array + { + return [ + 'type' => ApiKeyType::class, + 'abilities' => 'json', + 'last_used_at' => 'datetime', + ]; + } } diff --git a/app/Models/Server.php b/app/Models/Server.php index 9612c4a09dc..89ae70be5f6 100644 --- a/app/Models/Server.php +++ b/app/Models/Server.php @@ -15,13 +15,6 @@ class Server extends Model { use HasFactory; - protected $casts = [ - 'memory' => StorageSizeCast::class, - 'disk' => StorageSizeCast::class, - 'bandwidth_usage' => StorageSizeCast::class, - 'bandwidth_limit' => StorageSizeCast::class, - ]; - protected $guarded = [ 'id', 'updated_at', @@ -47,6 +40,16 @@ class Server extends Model 'hydrated_at' => 'nullable|date', ]; + protected function casts(): array + { + return [ + 'memory' => StorageSizeCast::class, + 'disk' => StorageSizeCast::class, + 'bandwidth_usage' => StorageSizeCast::class, + 'bandwidth_limit' => StorageSizeCast::class, + ]; + } + public function node(): BelongsTo { return $this->belongsTo(Node::class); @@ -115,7 +118,7 @@ public function isSuspended(): bool public function validateCurrentState(): void { if ( - !is_null($this->status) + ! is_null($this->status) ) { throw new ServerStatusConflictException($this); } diff --git a/app/Models/Snapshot.php b/app/Models/Snapshot.php index 60959116975..5f796dfc140 100644 --- a/app/Models/Snapshot.php +++ b/app/Models/Snapshot.php @@ -37,12 +37,12 @@ public function server(): BelongsTo public function snapshot(): BelongsTo { - return $this->belongsTo(Snapshot::class); + return $this->belongsTo(self::class); } public function children(): HasMany { - return $this->hasMany(Snapshot::class, 'snapshot_id')->with('children'); + return $this->hasMany(self::class, 'snapshot_id')->with('children'); } protected static function boot(): void diff --git a/app/Models/Storage.php b/app/Models/Storage.php index ec544853996..fe534399885 100644 --- a/app/Models/Storage.php +++ b/app/Models/Storage.php @@ -16,10 +16,6 @@ class Storage extends Model 'id', ]; - protected $casts = [ - 'size' => StorageSizeCast::class, - ]; - public static array $validationRules = [ 'nickname' => 'required_if:is_shareable,1|string|max:40', 'description' => 'nullable|string|max:191', @@ -34,6 +30,13 @@ class Storage extends Model 'has_snippets' => 'required|boolean', ]; + protected function casts(): array + { + return [ + 'size' => StorageSizeCast::class, + ]; + } + public function nodes(): BelongsToMany { return $this->belongsToMany( diff --git a/app/Models/User.php b/app/Models/User.php index 8049693f2fe..80b772066f3 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -59,21 +59,23 @@ class User extends Model implements AuthenticatableContract, AuthorizableContrac ]; /** - * The attributes that should be cast. + * Get the attributes that should be cast. * - * @var array + * @return array */ - protected $casts = [ - 'email_verified_at' => 'datetime', - 'root_admin' => 'boolean', - ]; + protected function casts(): array + { + return [ + 'email_verified_at' => 'datetime', + 'root_admin' => 'boolean', + ]; + } public function createToken( - string $name, + string $name, ApiKeyType $type, - array $abilities = ['*'], - ): NewAccessToken - { + array $abilities = ['*'], + ): NewAccessToken { $token = $this->tokens()->create([ 'type' => $type, 'name' => $name, @@ -81,7 +83,7 @@ public function createToken( 'abilities' => $abilities, ]); - return new NewAccessToken($token, $token->getKey() . '|' . $plainTextToken); + return new NewAccessToken($token, $token->getKey().'|'.$plainTextToken); } public function servers(): HasMany diff --git a/app/Policies/BackupPolicy.php b/app/Policies/BackupPolicy.php index fc2cd3561f9..fccc9026666 100644 --- a/app/Policies/BackupPolicy.php +++ b/app/Policies/BackupPolicy.php @@ -8,8 +8,7 @@ class BackupPolicy { public function before(User $user, string $ability, Server $server, - ): ?bool - { + ): ?bool { if ($user->root_admin || $user->id === $server->user_id) { return true; } diff --git a/app/Providers/ActivityLogServiceProvider.php b/app/Providers/ActivityLogServiceProvider.php index f58c6cb3855..a60099c2c24 100644 --- a/app/Providers/ActivityLogServiceProvider.php +++ b/app/Providers/ActivityLogServiceProvider.php @@ -2,9 +2,9 @@ namespace Convoy\Providers; -use Illuminate\Support\ServiceProvider; use Convoy\Services\Activity\ActivityLogBatchService; use Convoy\Services\Activity\ActivityLogTargetableService; +use Illuminate\Support\ServiceProvider; class ActivityLogServiceProvider extends ServiceProvider { diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 0ece9f23b85..d2c4bf357d0 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -3,11 +3,22 @@ namespace Convoy\Providers; use Convoy\Models\PersonalAccessToken; +use Convoy\Models\Server; +use Illuminate\Support\Facades\Route; use Illuminate\Support\ServiceProvider; use Laravel\Sanctum\Sanctum; class AppServiceProvider extends ServiceProvider { + /** + * The path to the "home" route for your application. + * + * Typically, users are redirected here after authentication. + * + * @var string + */ + public const HOME = '/'; + /** * Register any application services. */ @@ -22,5 +33,15 @@ public function register(): void public function boot(): void { Sanctum::usePersonalAccessTokenModel(PersonalAccessToken::class); + + $this->bootRoute(); + } + + public function bootRoute(): void + { + Route::bind('server', function ($value) { + return Server::query()->where(strlen($value) === 8 ? 'uuid_short' : 'uuid', $value) + ->firstOrFail(); + }); } } diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php deleted file mode 100644 index fdfaae6887b..00000000000 --- a/app/Providers/AuthServiceProvider.php +++ /dev/null @@ -1,25 +0,0 @@ - - */ - protected $policies = [ - // 'Convoy\Models\Model' => 'Convoy\Policies\ModelPolicy', - ]; - - /** - * Register any authentication / authorization services. - */ - public function boot(): void - { - // - } -} diff --git a/app/Providers/BroadcastServiceProvider.php b/app/Providers/BroadcastServiceProvider.php deleted file mode 100644 index fff804a00c7..00000000000 --- a/app/Providers/BroadcastServiceProvider.php +++ /dev/null @@ -1,19 +0,0 @@ -> - */ - protected $listen = [ - Registered::class => [ - SendEmailVerificationNotification::class, - ], - ]; - - /** - * Register any events for your application. - */ - public function boot(): void - { - // - } - - /** - * Determine if events and listeners should be automatically discovered. - */ - public function shouldDiscoverEvents(): bool - { - return false; - } -} diff --git a/app/Providers/FortifyServiceProvider.php b/app/Providers/FortifyServiceProvider.php index ea778c3377e..2911df57e1a 100644 --- a/app/Providers/FortifyServiceProvider.php +++ b/app/Providers/FortifyServiceProvider.php @@ -2,15 +2,15 @@ namespace Convoy\Providers; -use Illuminate\Http\Request; -use Laravel\Fortify\Fortify; -use Illuminate\Support\ServiceProvider; -use Illuminate\Cache\RateLimiting\Limit; use Convoy\Actions\Fortify\CreateNewUser; -use Illuminate\Support\Facades\RateLimiter; use Convoy\Actions\Fortify\ResetUserPassword; use Convoy\Actions\Fortify\UpdateUserPassword; use Convoy\Actions\Fortify\UpdateUserProfileInformation; +use Illuminate\Cache\RateLimiting\Limit; +use Illuminate\Http\Request; +use Illuminate\Support\Facades\RateLimiter; +use Illuminate\Support\ServiceProvider; +use Laravel\Fortify\Fortify; class FortifyServiceProvider extends ServiceProvider { diff --git a/app/Providers/RepositoryServiceProvider.php b/app/Providers/RepositoryServiceProvider.php index b7a0912399e..4c2bbeb69c7 100644 --- a/app/Providers/RepositoryServiceProvider.php +++ b/app/Providers/RepositoryServiceProvider.php @@ -2,9 +2,9 @@ namespace Convoy\Providers; -use Illuminate\Support\ServiceProvider; -use Convoy\Repositories\Eloquent\ActivityRepository; use Convoy\Contracts\Repository\ActivityRepositoryInterface; +use Convoy\Repositories\Eloquent\ActivityRepository; +use Illuminate\Support\ServiceProvider; class RepositoryServiceProvider extends ServiceProvider { diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php deleted file mode 100644 index 712194c95ff..00000000000 --- a/app/Providers/RouteServiceProvider.php +++ /dev/null @@ -1,66 +0,0 @@ -where(strlen($value) === 8 ? 'uuid_short' : 'uuid', $value) - ->firstOrFail(); - }); - - $this->routes(function () { - Route::middleware('web')->group(function () { - Route::middleware('guest')->group(base_path('routes/auth.php')); - - Route::middleware(['auth.session']) - ->group(base_path('routes/base.php')); - - Route::middleware(['auth'])->prefix('/api/client') - ->as('client.') - ->scopeBindings() - ->group(base_path('routes/api-client.php')); - - Route::middleware(['auth', AdminAuthenticate::class]) - ->prefix('/api/admin') - ->as('admin.') - ->scopeBindings() - ->group(base_path('routes/api-admin.php')); - }); - - Route::middleware(['api'])->group(function () { - Route::middleware(['auth:sanctum']) - ->prefix('/api/application') - ->as('application.') - ->scopeBindings() - ->group(base_path('routes/api-application.php')); - - Route::middleware([CotermAuthenticate::class]) - ->prefix('/api/coterm') - ->as('coterm.') - ->scopeBindings() - ->group(base_path('routes/api-coterm.php')); - }); - }); - } -} diff --git a/app/Repositories/Eloquent/ActivityRepository.php b/app/Repositories/Eloquent/ActivityRepository.php index 5b17a3876f1..bafde762c62 100644 --- a/app/Repositories/Eloquent/ActivityRepository.php +++ b/app/Repositories/Eloquent/ActivityRepository.php @@ -2,9 +2,9 @@ namespace Convoy\Repositories\Eloquent; -use Convoy\Models\Server; -use Convoy\Models\ActivityLog; use Convoy\Contracts\Repository\ActivityRepositoryInterface; +use Convoy\Models\ActivityLog; +use Convoy\Models\Server; class ActivityRepository extends EloquentRepository implements ActivityRepositoryInterface { diff --git a/app/Repositories/Eloquent/AddressRepository.php b/app/Repositories/Eloquent/AddressRepository.php index 7b2f19b6ede..6dbef75b07d 100644 --- a/app/Repositories/Eloquent/AddressRepository.php +++ b/app/Repositories/Eloquent/AddressRepository.php @@ -16,7 +16,6 @@ public function attachAddresses(Server $server, array $addressIds): void { $placeholders = implode(',', array_fill(0, count($addressIds), '?')); - $query = <<<'SQL' UPDATE ip_addresses SET server_id = ? @@ -40,4 +39,4 @@ public function attachAddresses(Server $server, array $addressIds): void $server->node_id, ]); } -} \ No newline at end of file +} diff --git a/app/Repositories/Eloquent/EloquentRepository.php b/app/Repositories/Eloquent/EloquentRepository.php index 6fdedea1a7a..22c765a4a56 100644 --- a/app/Repositories/Eloquent/EloquentRepository.php +++ b/app/Repositories/Eloquent/EloquentRepository.php @@ -3,18 +3,18 @@ namespace Convoy\Repositories\Eloquent; use Closure; -use Illuminate\Http\Request; -use Webmozart\Assert\Assert; -use Illuminate\Support\Collection; -use Convoy\Repositories\Repository; -use Illuminate\Database\Eloquent\Model; -use Illuminate\Database\Eloquent\Builder; -use Illuminate\Database\Query\Expression; use Convoy\Contracts\Repository\RepositoryInterface; use Convoy\Exceptions\Model\DataValidationException; -use Illuminate\Database\Eloquent\ModelNotFoundException; use Convoy\Exceptions\Repository\RecordNotFoundException; +use Convoy\Repositories\Repository; use Illuminate\Contracts\Pagination\LengthAwarePaginator; +use Illuminate\Database\Eloquent\Builder; +use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\ModelNotFoundException; +use Illuminate\Database\Query\Expression; +use Illuminate\Http\Request; +use Illuminate\Support\Collection; +use Webmozart\Assert\Assert; abstract class EloquentRepository extends Repository implements RepositoryInterface { diff --git a/app/Repositories/Eloquent/ServerRepository.php b/app/Repositories/Eloquent/ServerRepository.php index 70ee2d374d0..c520813463f 100644 --- a/app/Repositories/Eloquent/ServerRepository.php +++ b/app/Repositories/Eloquent/ServerRepository.php @@ -17,7 +17,7 @@ public function model(): string public function isUniqueVmId(int $nodeId, int $vmid): bool { - return !$this->getBuilder() + return ! $this->getBuilder() ->where('vmid', '=', $vmid) ->where('node_id', '=', $nodeId) ->exists(); @@ -28,7 +28,7 @@ public function isUniqueVmId(int $nodeId, int $vmid): bool */ public function isUniqueUuidCombo(string $uuid, string $short): bool { - return !$this->getBuilder()->where('uuid', '=', $uuid)->orWhere('uuid_short', '=', $short) + return ! $this->getBuilder()->where('uuid', '=', $uuid)->orWhere('uuid_short', '=', $short) ->exists(); } diff --git a/app/Repositories/Eloquent/SnapshotRepository.php b/app/Repositories/Eloquent/SnapshotRepository.php index 0ba3678c5d8..9325b452a8a 100644 --- a/app/Repositories/Eloquent/SnapshotRepository.php +++ b/app/Repositories/Eloquent/SnapshotRepository.php @@ -31,4 +31,4 @@ public function buildSnapshotTree($snapshots, $parentId = null): Snapshot|array| return is_null($parentId) ? Arr::first($branch) : $branch; // Return the constructed tree } -} \ No newline at end of file +} diff --git a/app/Repositories/Proxmox/Node/ProxmoxAccessRepository.php b/app/Repositories/Proxmox/Node/ProxmoxAccessRepository.php index 44381e485e1..8fe994ea28d 100644 --- a/app/Repositories/Proxmox/Node/ProxmoxAccessRepository.php +++ b/app/Repositories/Proxmox/Node/ProxmoxAccessRepository.php @@ -2,14 +2,14 @@ namespace Convoy\Repositories\Proxmox\Node; -use Convoy\Models\Node; -use Illuminate\Support\Str; -use Webmozart\Assert\Assert; -use Convoy\Data\Node\Access\UserData; -use Convoy\Enums\Node\Access\RealmType; use Convoy\Data\Node\Access\CreateUserData; use Convoy\Data\Node\Access\UserCredentialsData; +use Convoy\Data\Node\Access\UserData; +use Convoy\Enums\Node\Access\RealmType; +use Convoy\Models\Node; use Convoy\Repositories\Proxmox\ProxmoxRepository; +use Illuminate\Support\Str; +use Webmozart\Assert\Assert; class ProxmoxAccessRepository extends ProxmoxRepository { diff --git a/app/Repositories/Proxmox/Node/ProxmoxStorageRepository.php b/app/Repositories/Proxmox/Node/ProxmoxStorageRepository.php index 8b8ab9bc47a..c744a2bf23e 100644 --- a/app/Repositories/Proxmox/Node/ProxmoxStorageRepository.php +++ b/app/Repositories/Proxmox/Node/ProxmoxStorageRepository.php @@ -18,11 +18,10 @@ class ProxmoxStorageRepository extends ProxmoxRepository { public function download( - ContentType $contentType, string $fileName, string $link, - ?bool $verifyCertificates = true, + ContentType $contentType, string $fileName, string $link, + ?bool $verifyCertificates = true, ?ChecksumData $checksumData = null, - ) - { + ) { Assert::isInstanceOf($this->node, Node::class); Assert::regex($link, '/^(http|https):\/\//'); diff --git a/app/Repositories/Proxmox/ProxmoxRepository.php b/app/Repositories/Proxmox/ProxmoxRepository.php index cb02cb9a295..c57dd2585e4 100644 --- a/app/Repositories/Proxmox/ProxmoxRepository.php +++ b/app/Repositories/Proxmox/ProxmoxRepository.php @@ -66,8 +66,7 @@ public function getData(array|string $response): mixed */ public function getHttpClient( array $headers = [], array $options = [], bool $shouldAuthorize = true, - ): PendingRequest - { + ): PendingRequest { Assert::isInstanceOf($this->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..d0373270e61 100644 --- a/app/Repositories/Proxmox/Server/ProxmoxActivityRepository.php +++ b/app/Repositories/Proxmox/Server/ProxmoxActivityRepository.php @@ -4,8 +4,8 @@ use Convoy\Models\Node; use Convoy\Models\Server; -use Webmozart\Assert\Assert; use Convoy\Repositories\Proxmox\ProxmoxRepository; +use Webmozart\Assert\Assert; class ProxmoxActivityRepository extends ProxmoxRepository { diff --git a/app/Repositories/Proxmox/Server/ProxmoxBackupRepository.php b/app/Repositories/Proxmox/Server/ProxmoxBackupRepository.php index 4f2d4359507..48569d97954 100644 --- a/app/Repositories/Proxmox/Server/ProxmoxBackupRepository.php +++ b/app/Repositories/Proxmox/Server/ProxmoxBackupRepository.php @@ -2,12 +2,12 @@ namespace Convoy\Repositories\Proxmox\Server; +use Convoy\Enums\Server\BackupCompressionType; +use Convoy\Enums\Server\BackupMode; use Convoy\Models\Backup; use Convoy\Models\Server; -use Webmozart\Assert\Assert; -use Convoy\Enums\Server\BackupMode; -use Convoy\Enums\Server\BackupCompressionType; use Convoy\Repositories\Proxmox\ProxmoxRepository; +use Webmozart\Assert\Assert; class ProxmoxBackupRepository extends ProxmoxRepository { diff --git a/app/Repositories/Proxmox/Server/ProxmoxCloudinitRepository.php b/app/Repositories/Proxmox/Server/ProxmoxCloudinitRepository.php index da6920e44c4..aa2b61eb7ca 100644 --- a/app/Repositories/Proxmox/Server/ProxmoxCloudinitRepository.php +++ b/app/Repositories/Proxmox/Server/ProxmoxCloudinitRepository.php @@ -2,10 +2,10 @@ namespace Convoy\Repositories\Proxmox\Server; +use Convoy\Exceptions\Repository\Proxmox\ProxmoxConnectionException; use Convoy\Models\Server; -use Webmozart\Assert\Assert; use Convoy\Repositories\Proxmox\ProxmoxRepository; -use Convoy\Exceptions\Repository\Proxmox\ProxmoxConnectionException; +use Webmozart\Assert\Assert; class ProxmoxCloudinitRepository extends ProxmoxRepository { diff --git a/app/Repositories/Proxmox/Server/ProxmoxConfigRepository.php b/app/Repositories/Proxmox/Server/ProxmoxConfigRepository.php index 829de63a94d..706e3733f27 100644 --- a/app/Repositories/Proxmox/Server/ProxmoxConfigRepository.php +++ b/app/Repositories/Proxmox/Server/ProxmoxConfigRepository.php @@ -3,8 +3,8 @@ namespace Convoy\Repositories\Proxmox\Server; use Convoy\Models\Server; -use Webmozart\Assert\Assert; use Convoy\Repositories\Proxmox\ProxmoxRepository; +use Webmozart\Assert\Assert; class ProxmoxConfigRepository extends ProxmoxRepository { diff --git a/app/Repositories/Proxmox/Server/ProxmoxConsoleRepository.php b/app/Repositories/Proxmox/Server/ProxmoxConsoleRepository.php index bca6973233a..84480334724 100644 --- a/app/Repositories/Proxmox/Server/ProxmoxConsoleRepository.php +++ b/app/Repositories/Proxmox/Server/ProxmoxConsoleRepository.php @@ -2,13 +2,13 @@ namespace Convoy\Repositories\Proxmox\Server; -use Convoy\Models\Server; -use Webmozart\Assert\Assert; -use GuzzleHttp\Cookie\CookieJar; use Convoy\Data\Node\Access\UserCredentialsData; -use Convoy\Repositories\Proxmox\ProxmoxRepository; use Convoy\Data\Server\Proxmox\Console\NoVncCredentialsData; use Convoy\Data\Server\Proxmox\Console\XTermCredentialsData; +use Convoy\Models\Server; +use Convoy\Repositories\Proxmox\ProxmoxRepository; +use GuzzleHttp\Cookie\CookieJar; +use Webmozart\Assert\Assert; class ProxmoxConsoleRepository extends ProxmoxRepository { @@ -17,18 +17,18 @@ public function createNoVncCredentials(UserCredentialsData $credentials): NoVncC Assert::isInstanceOf($this->server, Server::class); $response = $this->getHttpClient(headers: [ - 'CSRFPreventionToken' => $credentials->csrf_token + 'CSRFPreventionToken' => $credentials->csrf_token, ], options: [ 'cookies' => CookieJar::fromArray([ 'PVEAuthCookie' => $credentials->ticket, - ], $this->node->fqdn) + ], $this->node->fqdn), ], shouldAuthorize: false) ->withUrlParameters([ 'node' => $this->node->cluster, 'server' => $this->server->vmid, ]) ->post('/api2/json/nodes/{node}/qemu/{server}/vncproxy', [ - 'websocket' => true + 'websocket' => true, ]) ->json(); @@ -46,18 +46,18 @@ public function createXTermjsCredentials(UserCredentialsData $credentials): XTer Assert::isInstanceOf($this->server, Server::class); $response = $this->getHttpClient(headers: [ - 'CSRFPreventionToken' => $credentials->csrf_token + 'CSRFPreventionToken' => $credentials->csrf_token, ], options: [ 'cookies' => CookieJar::fromArray([ 'PVEAuthCookie' => $credentials->ticket, - ], $this->node->fqdn) + ], $this->node->fqdn), ], shouldAuthorize: false) ->withUrlParameters([ 'node' => $this->node->cluster, 'server' => $this->server->vmid, ]) ->post('/api2/json/nodes/{node}/qemu/{server}/termproxy', [ - 'vmid' => $this->server->vmid // this is to fix the "NOT A HASH REFERENCE" stupid error Proxmox has if there's no JSON body + 'vmid' => $this->server->vmid, // this is to fix the "NOT A HASH REFERENCE" stupid error Proxmox has if there's no JSON body // bruh fix ur shit proxmox ]) ->json(); diff --git a/app/Repositories/Proxmox/Server/ProxmoxFirewallRepository.php b/app/Repositories/Proxmox/Server/ProxmoxFirewallRepository.php index 4dc0cf7f47f..2130b54f608 100644 --- a/app/Repositories/Proxmox/Server/ProxmoxFirewallRepository.php +++ b/app/Repositories/Proxmox/Server/ProxmoxFirewallRepository.php @@ -3,8 +3,8 @@ namespace Convoy\Repositories\Proxmox\Server; use Convoy\Models\Server; -use Webmozart\Assert\Assert; use Convoy\Repositories\Proxmox\ProxmoxRepository; +use Webmozart\Assert\Assert; class ProxmoxFirewallRepository extends ProxmoxRepository { diff --git a/app/Repositories/Proxmox/Server/ProxmoxPowerRepository.php b/app/Repositories/Proxmox/Server/ProxmoxPowerRepository.php index f00177d7ee1..b17fb1b93ce 100644 --- a/app/Repositories/Proxmox/Server/ProxmoxPowerRepository.php +++ b/app/Repositories/Proxmox/Server/ProxmoxPowerRepository.php @@ -2,10 +2,10 @@ namespace Convoy\Repositories\Proxmox\Server; -use Convoy\Models\Server; -use Webmozart\Assert\Assert; use Convoy\Enums\Server\PowerAction; +use Convoy\Models\Server; use Convoy\Repositories\Proxmox\ProxmoxRepository; +use Webmozart\Assert\Assert; class ProxmoxPowerRepository extends ProxmoxRepository { diff --git a/app/Repositories/Proxmox/Server/ProxmoxServerRepository.php b/app/Repositories/Proxmox/Server/ProxmoxServerRepository.php index 79d7ac656ab..0481b762e2b 100644 --- a/app/Repositories/Proxmox/Server/ProxmoxServerRepository.php +++ b/app/Repositories/Proxmox/Server/ProxmoxServerRepository.php @@ -76,8 +76,8 @@ public function addUser(RealmType $realmType, string $userId, string $roleId) $response = $this->getHttpClient() ->put('/api2/json/access/acl', [ - 'path' => '/vms/' . $this->server->vmid, - 'users' => $userId . '@' . $realmType->value, + 'path' => '/vms/'.$this->server->vmid, + 'users' => $userId.'@'.$realmType->value, 'roles' => $roleId, ]) ->json(); diff --git a/app/Repositories/Proxmox/Server/ProxmoxSnapshotRepository.php b/app/Repositories/Proxmox/Server/ProxmoxSnapshotRepository.php index 9aefce3d409..55d70b01f8a 100644 --- a/app/Repositories/Proxmox/Server/ProxmoxSnapshotRepository.php +++ b/app/Repositories/Proxmox/Server/ProxmoxSnapshotRepository.php @@ -3,8 +3,8 @@ namespace Convoy\Repositories\Proxmox\Server; use Convoy\Models\Server; -use Webmozart\Assert\Assert; use Convoy\Repositories\Proxmox\ProxmoxRepository; +use Webmozart\Assert\Assert; class ProxmoxSnapshotRepository extends ProxmoxRepository { diff --git a/app/Repositories/Proxmox/Server/ProxmoxStatisticsRepository.php b/app/Repositories/Proxmox/Server/ProxmoxStatisticsRepository.php index 7fd1776d9b7..319c961761d 100644 --- a/app/Repositories/Proxmox/Server/ProxmoxStatisticsRepository.php +++ b/app/Repositories/Proxmox/Server/ProxmoxStatisticsRepository.php @@ -17,10 +17,9 @@ class ProxmoxStatisticsRepository extends ProxmoxRepository { public function getStatistics( - StatisticTimeRange $from, + StatisticTimeRange $from, StatisticConsolidatorFunction $consolidator = StatisticConsolidatorFunction::AVERAGE, - ): DataCollection - { + ): DataCollection { Assert::isInstanceOf($this->server, Server::class); $response = $this->getHttpClient() diff --git a/app/Repositories/Repository.php b/app/Repositories/Repository.php index 3924b3a4252..f846d79b39e 100644 --- a/app/Repositories/Repository.php +++ b/app/Repositories/Repository.php @@ -3,10 +3,10 @@ namespace Convoy\Repositories; use Closure; -use InvalidArgumentException; -use Illuminate\Foundation\Application; -use Illuminate\Database\Eloquent\Model; use Convoy\Contracts\Repository\RepositoryInterface; +use Illuminate\Database\Eloquent\Model; +use Illuminate\Foundation\Application; +use InvalidArgumentException; abstract class Repository implements RepositoryInterface { @@ -49,7 +49,7 @@ public function getModel(): Model * @param array|string $columns * @return $this */ - public function setColumns($columns = ['*']): Repository|static + public function setColumns($columns = ['*']): self|static { $clone = clone $this; $clone->columns = is_array($columns) ? $columns : func_get_args(); @@ -71,7 +71,7 @@ public function getColumns(): array * * @return $this */ - public function withoutFreshModel(): Repository|static + public function withoutFreshModel(): self|static { return $this->setFreshModel(false); } diff --git a/app/Rules/Fqdn.php b/app/Rules/Fqdn.php index f8fd41520b4..2b3fd2f0296 100644 --- a/app/Rules/Fqdn.php +++ b/app/Rules/Fqdn.php @@ -26,9 +26,9 @@ namespace Convoy\Rules; use Closure; -use Illuminate\Support\Arr; use Illuminate\Contracts\Validation\DataAwareRule; use Illuminate\Contracts\Validation\ValidationRule; +use Illuminate\Support\Arr; class Fqdn implements ValidationRule, DataAwareRule { diff --git a/app/Rules/Hostname.php b/app/Rules/Hostname.php index 95eecc879ab..2e061432606 100644 --- a/app/Rules/Hostname.php +++ b/app/Rules/Hostname.php @@ -14,7 +14,7 @@ class Hostname implements ValidationRule */ public function validate(string $attribute, $value, Closure $fail): void { - if (!(bool)filter_var($value, FILTER_VALIDATE_DOMAIN)) { + if (! (bool) filter_var($value, FILTER_VALIDATE_DOMAIN)) { $fail(__('validation.hostname')); } } diff --git a/app/Rules/Password.php b/app/Rules/Password.php index 85d670d6ea2..8dcaf559a66 100644 --- a/app/Rules/Password.php +++ b/app/Rules/Password.php @@ -14,7 +14,7 @@ class Password implements ValidationRule */ public function validate(string $attribute, $value, Closure $fail): void { - if (!(bool)preg_match('/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#\$%\^&\*])(?=.{8,})/', $value)) { + if (! (bool) preg_match('/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#\$%\^&\*])(?=.{8,})/', $value)) { $fail(__('validation.password.default')); } } diff --git a/app/Rules/USKeyboardCharacters.php b/app/Rules/USKeyboardCharacters.php index 603797658cf..5521f8a3de2 100644 --- a/app/Rules/USKeyboardCharacters.php +++ b/app/Rules/USKeyboardCharacters.php @@ -9,7 +9,7 @@ class USKeyboardCharacters implements ValidationRule { public function validate(string $attribute, mixed $value, Closure $fail): void { - if (!(bool)preg_match('/^[\x20-\x7F]*$/', $value)) { + if (! (bool) preg_match('/^[\x20-\x7F]*$/', $value)) { $fail(__('validation.us_keyboard_characters')); } } diff --git a/app/Services/Activity/ActivityLogService.php b/app/Services/Activity/ActivityLogService.php index 8c01ace0081..835b65e7324 100644 --- a/app/Services/Activity/ActivityLogService.php +++ b/app/Services/Activity/ActivityLogService.php @@ -8,18 +8,18 @@ namespace Convoy\Services\Activity; use Closure; -use Exception; -use Throwable; -use Illuminate\Support\Arr; -use Webmozart\Assert\Assert; use Convoy\Models\ActivityLog; -use Illuminate\Support\Collection; -use Illuminate\Support\Facades\Log; use Convoy\Models\ActivityLogSubject; +use Exception; use Illuminate\Contracts\Auth\Factory; +use Illuminate\Database\ConnectionInterface; use Illuminate\Database\Eloquent\Model; +use Illuminate\Support\Arr; +use Illuminate\Support\Collection; +use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Request; -use Illuminate\Database\ConnectionInterface; +use Throwable; +use Webmozart\Assert\Assert; class ActivityLogService { diff --git a/app/Services/Activity/BulkAddressCreationService.php b/app/Services/Activity/BulkAddressCreationService.php index 9acb1d71eed..bdb0f64a397 100644 --- a/app/Services/Activity/BulkAddressCreationService.php +++ b/app/Services/Activity/BulkAddressCreationService.php @@ -3,23 +3,22 @@ namespace Convoy\Services\Activity; use Convoy\Enums\Network\AddressType; +use function Convoy\Helpers\getAddressesFromRange; use Convoy\Models\Address; use Illuminate\Support\Arr; -use function Convoy\Helpers\getAddressesFromRange; class BulkAddressCreationService { public function handle( AddressType $type, - string $from, - string $to, - int $poolId, - ?int $serverId = null, - int $cidr, - string $gateway, - ?string $macAddress = null, - ): void - { + string $from, + string $to, + int $poolId, + ?int $serverId, + int $cidr, + string $gateway, + ?string $macAddress = null, + ): void { $addresses = getAddressesFromRange($type, $from, $to); $existingAddresses = Address::where('address_pool_id', '=', $poolId) ->whereIn('address', $addresses) @@ -59,4 +58,4 @@ public function handle( 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..8f7c2acd163 100644 --- a/app/Services/Api/JWTService.php +++ b/app/Services/Api/JWTService.php @@ -2,20 +2,20 @@ namespace Convoy\Services\Api; -use Convoy\Models\User; use Carbon\CarbonImmutable; +use Convoy\Exceptions\Service\Api\InvalidJWTException; +use Convoy\Extensions\Lcobucci\JWT\Validation\Clock; +use Convoy\Models\User; use Illuminate\Support\Str; -use Lcobucci\JWT\Token\Plain; use Lcobucci\JWT\Configuration; -use Lcobucci\JWT\UnencryptedToken; +use Lcobucci\JWT\Encoding\CannotDecodeContent; use Lcobucci\JWT\Signer\Hmac\Sha256; use Lcobucci\JWT\Signer\Key\InMemory; use Lcobucci\JWT\Token\InvalidTokenStructure; -use Lcobucci\JWT\Encoding\CannotDecodeContent; +use Lcobucci\JWT\Token\Plain; use Lcobucci\JWT\Token\UnsupportedHeaderFound; -use Convoy\Extensions\Lcobucci\JWT\Validation\Clock; +use Lcobucci\JWT\UnencryptedToken; use Lcobucci\JWT\Validation\Constraint\StrictValidAt; -use Convoy\Exceptions\Service\Api\InvalidJWTException; class JWTService { @@ -86,7 +86,7 @@ public function handle(string $key, string $permittedFor, ?string $identifiedBy, $builder = $builder->expiresAt($this->expiresAt); } - if (!empty($this->subject)) { + if (! empty($this->subject)) { $builder = $builder->relatedTo($this->subject)->withHeader('sub', $this->subject); } @@ -94,7 +94,7 @@ public function handle(string $key, string $permittedFor, ?string $identifiedBy, $builder = $builder->withClaim($key, $value); } - if (!is_null($this->user)) { + if (! is_null($this->user)) { $builder = $builder ->withClaim('user_uuid', $this->user->uuid); } @@ -116,7 +116,7 @@ public function decode(string $key, string $token): UnencryptedToken assert($parsedToken instanceof UnencryptedToken); - if (!$config->validator()->validate($parsedToken, new StrictValidAt(new Clock))) { + if (! $config->validator()->validate($parsedToken, new StrictValidAt(new Clock))) { throw new InvalidJWTException; } diff --git a/app/Services/Backups/BackupCreationService.php b/app/Services/Backups/BackupCreationService.php index c655bbb2cfe..f7229a6cd21 100644 --- a/app/Services/Backups/BackupCreationService.php +++ b/app/Services/Backups/BackupCreationService.php @@ -19,16 +19,14 @@ class BackupCreationService { public function __construct( private ConnectionInterface $connection, private ProxmoxBackupRepository $proxmoxRepository, - private BackupRepository $eloquentRepository, - ) - { + private BackupRepository $eloquentRepository, + ) { } public function create( Server $server, string $name, BackupMode $mode, BackupCompressionType $compressionType, - ?bool $isLocked = false, - ): ?Backup - { + ?bool $isLocked = false, + ): ?Backup { $limit = config('backups.throttles.limit'); $period = config('backups.throttles.period'); if ($period > 0) { @@ -50,9 +48,9 @@ public function create( } $successful = $this->eloquentRepository->getNonFailedBackups($server); - if (!$server->backup_limit || $successful->count() >= $server->backup_limit) { + if (! $server->backup_limit || $successful->count() >= $server->backup_limit) { if (isset($server->backup_limit)) { - throw new TooManyBackupsException((int)$server->backup_limit); + throw new TooManyBackupsException((int) $server->backup_limit); } } diff --git a/app/Services/Backups/BackupDeletionService.php b/app/Services/Backups/BackupDeletionService.php index 63d77c3f33c..f730c74c612 100644 --- a/app/Services/Backups/BackupDeletionService.php +++ b/app/Services/Backups/BackupDeletionService.php @@ -9,15 +9,14 @@ class BackupDeletionService { - public function __construct(private ConnectionInterface $connection, + public function __construct(private ConnectionInterface $connection, private ProxmoxBackupRepository $proxmoxRepository, - ) - { + ) { } public function handle(Backup $backup) { - if ($backup->is_locked && ($backup->is_successful && !is_null($backup->completed_at))) { + if ($backup->is_locked && ($backup->is_successful && ! is_null($backup->completed_at))) { throw new BackupLockedException(); } diff --git a/app/Services/Backups/BackupMonitorService.php b/app/Services/Backups/BackupMonitorService.php index 57b4724ef0d..0a8086b9b1a 100644 --- a/app/Services/Backups/BackupMonitorService.php +++ b/app/Services/Backups/BackupMonitorService.php @@ -15,9 +15,8 @@ class BackupMonitorService { public function __construct( private ProxmoxActivityRepository $repository, - private ProxmoxBackupRepository $backupRepository, - ) - { + private ProxmoxBackupRepository $backupRepository, + ) { } public function checkCreationProgress(Backup $backup, string $upid, ?Closure $callback = null) @@ -63,8 +62,7 @@ public function checkCreationProgress(Backup $backup, string $upid, ?Closure $ca } 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..49bfd704697 100644 --- a/app/Services/Backups/PurgeBackupsService.php +++ b/app/Services/Backups/PurgeBackupsService.php @@ -9,10 +9,9 @@ class PurgeBackupsService { public function __construct( - private BackupRepository $backupRepository, + private BackupRepository $backupRepository, private BackupDeletionService $backupDeletionService, - ) - { + ) { } public function handle(Server $server) diff --git a/app/Services/Backups/RestoreFromBackupService.php b/app/Services/Backups/RestoreFromBackupService.php index 2fc86a9116b..eccce518677 100644 --- a/app/Services/Backups/RestoreFromBackupService.php +++ b/app/Services/Backups/RestoreFromBackupService.php @@ -15,16 +15,15 @@ class RestoreFromBackupService { public function __construct( - private ConnectionInterface $connection, + private ConnectionInterface $connection, private ProxmoxServerRepository $serverRepository, private ProxmoxBackupRepository $proxmoxRepository, - ) - { + ) { } public function handle(Server $server, Backup $backup) { - if (!is_null($server->status)) { + if (! is_null($server->status)) { throw new BadRequestHttpException( 'This server is not currently in a state that allows for a backup to be restored.', ); @@ -37,7 +36,7 @@ public function handle(Server $server, Backup $backup) ); } - if (!$backup->successful && is_null($backup->completed_at)) { + if (! $backup->successful && is_null($backup->completed_at)) { throw new BadRequestHttpException( 'This backup cannot be restored at this time: not completed or failed.', ); diff --git a/app/Services/Coterm/CotermJWTService.php b/app/Services/Coterm/CotermJWTService.php index e8e66004971..d3c3d68c46a 100644 --- a/app/Services/Coterm/CotermJWTService.php +++ b/app/Services/Coterm/CotermJWTService.php @@ -33,9 +33,9 @@ public function handle(Server $server, User $user, ConsoleType $consoleType): Pl ]) ->handle( $server->node->coterm->token, $server->node->getCotermConnectionAddress(), - $user->uuid . $server->uuid, + $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..815d84b39a8 100644 --- a/app/Services/Coterm/CotermTokenCreationService.php +++ b/app/Services/Coterm/CotermTokenCreationService.php @@ -23,4 +23,4 @@ public function handle(): array 'token_id' => Str::random(Coterm::COTERM_TOKEN_ID_LENGTH), ]; } -} \ No newline at end of file +} diff --git a/app/Services/Isos/IsoService.php b/app/Services/Isos/IsoService.php index f6e31f735f7..6d87ef5d332 100644 --- a/app/Services/Isos/IsoService.php +++ b/app/Services/Isos/IsoService.php @@ -16,15 +16,13 @@ class IsoService { public function __construct( private ConnectionInterface $connection, private ProxmoxStorageRepository $repository, - ) - { + ) { } public function download( - Node $node, string $name, ?string $fileName, string $link, + Node $node, string $name, ?string $fileName, string $link, ?ChecksumData $checksumData = null, ?bool $hidden = false, - ) - { + ) { $queriedFileMetadata = $this->repository->setNode($node)->getFileMetadata($link); return $this->connection->transaction( diff --git a/app/Services/Nodes/ServerRateLimitsSyncService.php b/app/Services/Nodes/ServerRateLimitsSyncService.php index bb3c07f2c81..f686778d5c9 100644 --- a/app/Services/Nodes/ServerRateLimitsSyncService.php +++ b/app/Services/Nodes/ServerRateLimitsSyncService.php @@ -2,10 +2,10 @@ namespace Convoy\Services\Nodes; +use Convoy\Exceptions\Repository\Proxmox\ProxmoxConnectionException; use Convoy\Models\Node; use Convoy\Models\Server; use Convoy\Services\Servers\NetworkService; -use Convoy\Exceptions\Repository\Proxmox\ProxmoxConnectionException; class ServerRateLimitsSyncService { diff --git a/app/Services/Nodes/UserPruneService.php b/app/Services/Nodes/UserPruneService.php index 9252b9f231e..1146872cf01 100644 --- a/app/Services/Nodes/UserPruneService.php +++ b/app/Services/Nodes/UserPruneService.php @@ -2,8 +2,8 @@ namespace Convoy\Services\Nodes; -use Convoy\Models\Node; use Convoy\Data\Node\Access\UserData; +use Convoy\Models\Node; use Convoy\Repositories\Proxmox\Node\ProxmoxAccessRepository; class UserPruneService diff --git a/app/Services/Servers/AllocationService.php b/app/Services/Servers/AllocationService.php index 98fd7029432..d594c424c67 100644 --- a/app/Services/Servers/AllocationService.php +++ b/app/Services/Servers/AllocationService.php @@ -86,7 +86,7 @@ public function getBootOrder(Server $server): DataCollection array_filter( explode(';', Arr::last(explode('=', $raw['pending'] ?? $raw['value']))), function ($disk) { - return !ctype_space($disk) && in_array( + return ! ctype_space($disk) && in_array( $disk, array_column(DiskInterface::cases(), 'value'), ); // filter literally whitespace entries because Proxmox keeps empty strings for some reason >:( @@ -109,7 +109,7 @@ function ($disk) { public function setBootOrder(Server $server, array $disks) { return $this->repository->setServer($server)->update([ - 'boot' => count($disks) > 0 ? 'order=' . Arr::join($disks, ';') : '', + 'boot' => count($disks) > 0 ? 'order='.Arr::join($disks, ';') : '', ]); } @@ -141,7 +141,7 @@ public function mountIso(Server $server, ISO $iso): void throw new NoAvailableDiskInterfaceException(); } - if (!in_array("ide$i", $arrayToCheckForAvailableIdeIndex)) { + if (! in_array("ide$i", $arrayToCheckForAvailableIdeIndex)) { $ideIndex = $i; break; } @@ -165,7 +165,7 @@ public function unmountIso(Server $server, ISO $iso): void public function convertToBytes(string $from): ?int { $units = ['B', 'K', 'M', 'G', 'T', 'P']; - $number = (int)substr($from, 0, -1); + $number = (int) substr($from, 0, -1); $suffix = strtoupper(substr($from, -1)); //B or no suffix diff --git a/app/Services/Servers/CloudinitService.php b/app/Services/Servers/CloudinitService.php index 8544d5d76f6..14b4acc100d 100644 --- a/app/Services/Servers/CloudinitService.php +++ b/app/Services/Servers/CloudinitService.php @@ -2,12 +2,12 @@ namespace Convoy\Services\Servers; -use Convoy\Models\Server; -use Illuminate\Support\Arr; -use Convoy\Data\Server\Proxmox\Config\AddressConfigData; use Convoy\Data\Server\Deployments\CloudinitAddressConfigData; -use Convoy\Repositories\Proxmox\Server\ProxmoxConfigRepository; +use Convoy\Data\Server\Proxmox\Config\AddressConfigData; use Convoy\Exceptions\Repository\Proxmox\ProxmoxConnectionException; +use Convoy\Models\Server; +use Convoy\Repositories\Proxmox\Server\ProxmoxConfigRepository; +use Illuminate\Support\Arr; /** * Class SnapshotService diff --git a/app/Services/Servers/NetworkService.php b/app/Services/Servers/NetworkService.php index 6d01ee877b9..115a4ec254b 100644 --- a/app/Services/Servers/NetworkService.php +++ b/app/Services/Servers/NetworkService.php @@ -18,14 +18,13 @@ class NetworkService { public function __construct( - private AddressRepository $repository, - private ProxmoxFirewallRepository $firewallRepository, - private CloudinitService $cloudinitService, + private AddressRepository $repository, + private ProxmoxFirewallRepository $firewallRepository, + private CloudinitService $cloudinitService, private ProxmoxCloudinitRepository $cloudinitRepository, - private ProxmoxConfigRepository $allocationRepository, - private ConnectionInterface $connection, - ) - { + private ProxmoxConfigRepository $allocationRepository, + private ConnectionInterface $connection, + ) { } public function deleteIpset(Server $server, string $name) @@ -137,8 +136,8 @@ public function updateRateLimit(Server $server, ?int $mebibytes = null) $payload = "virtio={$macAddress},bridge={$server->node->network},firewall=1"; - if (!is_null($mebibytes)) { - $payload .= ',rate=' . $mebibytes; + if (! is_null($mebibytes)) { + $payload .= ',rate='.$mebibytes; } $this->allocationRepository->setServer($server)->update(['net0' => $payload]); @@ -150,14 +149,14 @@ 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)) { + if (! empty($addressesToAdd)) { $this->repository->attachAddresses($server, $addressesToAdd); } - if (!empty($addressesToRemove)) { + if (! empty($addressesToRemove)) { Address::query() ->where('server_id', $server->id) ->whereIn('id', $addressesToRemove) diff --git a/app/Services/Servers/ServerBuildDispatchService.php b/app/Services/Servers/ServerBuildDispatchService.php index 528d81e78fb..b5c5d763df1 100644 --- a/app/Services/Servers/ServerBuildDispatchService.php +++ b/app/Services/Servers/ServerBuildDispatchService.php @@ -2,20 +2,20 @@ namespace Convoy\Services\Servers; -use Convoy\Models\Server; +use Convoy\Data\Server\Deployments\ServerDeploymentData; +use Convoy\Enums\Server\PowerAction; use Convoy\Enums\Server\State; use Convoy\Enums\Server\Status; -use Illuminate\Support\Facades\Bus; -use Convoy\Enums\Server\PowerAction; -use Convoy\Jobs\Server\SyncBuildJob; use Convoy\Jobs\Server\BuildServerJob; use Convoy\Jobs\Server\DeleteServerJob; use Convoy\Jobs\Server\MonitorStateJob; -use Convoy\Jobs\Server\UpdatePasswordJob; use Convoy\Jobs\Server\SendPowerCommandJob; +use Convoy\Jobs\Server\SyncBuildJob; +use Convoy\Jobs\Server\UpdatePasswordJob; use Convoy\Jobs\Server\WaitUntilVmIsCreatedJob; use Convoy\Jobs\Server\WaitUntilVmIsDeletedJob; -use Convoy\Data\Server\Deployments\ServerDeploymentData; +use Convoy\Models\Server; +use Illuminate\Support\Facades\Bus; class ServerBuildDispatchService { diff --git a/app/Services/Servers/ServerBuildService.php b/app/Services/Servers/ServerBuildService.php index 9525c27e5d5..8559cd3c0a3 100644 --- a/app/Services/Servers/ServerBuildService.php +++ b/app/Services/Servers/ServerBuildService.php @@ -16,8 +16,7 @@ class ServerBuildService public function __construct( private ProxmoxConfigRepository $configRepository, private ProxmoxServerRepository $serverRepository, - ) - { + ) { } public function delete(Server $server): void diff --git a/app/Services/Servers/ServerConsoleService.php b/app/Services/Servers/ServerConsoleService.php index dcb5cf4b8f4..55337e52bab 100644 --- a/app/Services/Servers/ServerConsoleService.php +++ b/app/Services/Servers/ServerConsoleService.php @@ -2,16 +2,16 @@ namespace Convoy\Services\Servers; -use Exception; -use Convoy\Models\Server; -use Convoy\Enums\Node\Access\RealmType; use Convoy\Data\Node\Access\CreateUserData; use Convoy\Data\Node\Access\UserCredentialsData; use Convoy\Data\Server\Proxmox\Console\NoVncCredentialsData; use Convoy\Data\Server\Proxmox\Console\XTermCredentialsData; +use Convoy\Enums\Node\Access\RealmType; +use Convoy\Models\Server; use Convoy\Repositories\Proxmox\Node\ProxmoxAccessRepository; -use Convoy\Repositories\Proxmox\Server\ProxmoxServerRepository; use Convoy\Repositories\Proxmox\Server\ProxmoxConsoleRepository; +use Convoy\Repositories\Proxmox\Server\ProxmoxServerRepository; +use Exception; class ServerConsoleService { diff --git a/app/Services/Servers/ServerCreationService.php b/app/Services/Servers/ServerCreationService.php index 8c59d0743ba..cf437e556d5 100644 --- a/app/Services/Servers/ServerCreationService.php +++ b/app/Services/Servers/ServerCreationService.php @@ -19,10 +19,9 @@ class ServerCreationService { public function __construct( - private NetworkService $networkService, private ServerRepository $repository, + private NetworkService $networkService, private ServerRepository $repository, private ServerBuildDispatchService $buildDispatchService, - ) - { + ) { } public function handle(array $data) @@ -85,7 +84,7 @@ public function generateUniqueVmId(int $nodeId): int $vmid = random_int(100, 999999999); $attempts = 0; - while (!$this->repository->isUniqueVmId($nodeId, $vmid)) { + while (! $this->repository->isUniqueVmId($nodeId, $vmid)) { $vmid = random_int(100, 999999999); if ($attempts++ > 10) { @@ -102,7 +101,7 @@ public function generateUniqueUuidCombo(): string $short = substr($uuid, 0, 8); $attempts = 0; - while (!$this->repository->isUniqueUuidCombo($uuid, $short)) { + while (! $this->repository->isUniqueUuidCombo($uuid, $short)) { $uuid = Str::uuid()->toString(); $short = substr($uuid, 0, 8); diff --git a/app/Services/Servers/ServerDeletionService.php b/app/Services/Servers/ServerDeletionService.php index ff42bf91437..8df811d13b9 100644 --- a/app/Services/Servers/ServerDeletionService.php +++ b/app/Services/Servers/ServerDeletionService.php @@ -2,11 +2,11 @@ namespace Convoy\Services\Servers; -use Convoy\Models\Server; use Convoy\Enums\Server\Status; -use Illuminate\Support\Facades\Bus; -use Convoy\Jobs\Server\PurgeBackupsJob; use Convoy\Exceptions\Http\Server\ServerStatusConflictException; +use Convoy\Jobs\Server\PurgeBackupsJob; +use Convoy\Models\Server; +use Illuminate\Support\Facades\Bus; class ServerDeletionService { diff --git a/app/Services/Servers/ServerDetailService.php b/app/Services/Servers/ServerDetailService.php index cb6f4f46db7..df3c15ef98f 100644 --- a/app/Services/Servers/ServerDetailService.php +++ b/app/Services/Servers/ServerDetailService.php @@ -2,15 +2,15 @@ namespace Convoy\Services\Servers; -use Convoy\Models\Server; -use Illuminate\Support\Arr; -use Convoy\Data\Server\Proxmox\ServerProxmoxData; use Convoy\Data\Server\Eloquent\ServerEloquentData; +use Convoy\Data\Server\Proxmox\ServerProxmoxData; +use Convoy\Models\Server; use Convoy\Repositories\Proxmox\Server\ProxmoxConfigRepository; +use Illuminate\Support\Arr; class ServerDetailService { - public function __construct(private NetworkService $networkService, private ProxmoxConfigRepository $allocationRepository, private AllocationService $allocationService,) + public function __construct(private NetworkService $networkService, private ProxmoxConfigRepository $allocationRepository, private AllocationService $allocationService) { } diff --git a/app/Services/Servers/ServerSuspensionService.php b/app/Services/Servers/ServerSuspensionService.php index e27ead01aab..a5c07b40f39 100644 --- a/app/Services/Servers/ServerSuspensionService.php +++ b/app/Services/Servers/ServerSuspensionService.php @@ -2,12 +2,12 @@ namespace Convoy\Services\Servers; -use Exception; -use Convoy\Models\Server; -use Convoy\Enums\Server\Status; use Convoy\Enums\Server\PowerAction; +use Convoy\Enums\Server\Status; use Convoy\Enums\Server\SuspensionAction; +use Convoy\Models\Server; use Convoy\Repositories\Proxmox\Server\ProxmoxPowerRepository; +use Exception; class ServerSuspensionService { diff --git a/app/Services/Servers/SyncBuildService.php b/app/Services/Servers/SyncBuildService.php index 4503fc317aa..a721d3bdea6 100644 --- a/app/Services/Servers/SyncBuildService.php +++ b/app/Services/Servers/SyncBuildService.php @@ -12,14 +12,13 @@ readonly class SyncBuildService { public function __construct( - private AllocationService $allocationService, - private CloudinitService $cloudinitService, - private NetworkService $networkService, - private ServerDetailService $detailService, + private AllocationService $allocationService, + private CloudinitService $cloudinitService, + private NetworkService $networkService, + private ServerDetailService $detailService, private ProxmoxConfigRepository $allocationRepository, - private ProxmoxDiskRepository $diskRepository, - ) - { + private ProxmoxDiskRepository $diskRepository, + ) { } public function handle(Server $server): void @@ -41,7 +40,7 @@ public function handle(Server $server): void // find a disk that has a corresponding disk in the deployment $disksArray = collect($disks->toArray())->pluck('interface')->all(); $bootOrder = array_filter( - collect($bootOrder->filter(fn (DiskData $disk) => !$disk->is_media)->toArray())->pluck( + collect($bootOrder->filter(fn (DiskData $disk) => ! $disk->is_media)->toArray())->pluck( 'interface', )->toArray(), fn ($disk) => in_array($disk, $disksArray), ); diff --git a/app/Transformers/Admin/AddressPoolTransformer.php b/app/Transformers/Admin/AddressPoolTransformer.php index 1a6425b9856..cc1223e4a20 100644 --- a/app/Transformers/Admin/AddressPoolTransformer.php +++ b/app/Transformers/Admin/AddressPoolTransformer.php @@ -3,8 +3,8 @@ namespace Convoy\Transformers\Admin; use Convoy\Models\AddressPool; -use League\Fractal\TransformerAbstract; use League\Fractal\Resource\Collection; +use League\Fractal\TransformerAbstract; class AddressPoolTransformer extends TransformerAbstract { diff --git a/app/Transformers/Admin/AddressTransformer.php b/app/Transformers/Admin/AddressTransformer.php index 86fae869446..473b07fd056 100644 --- a/app/Transformers/Admin/AddressTransformer.php +++ b/app/Transformers/Admin/AddressTransformer.php @@ -21,7 +21,7 @@ public function transform(Address $address): array public function includeServer(Address $address): ?Item { - return !is_null($address->server) ? $this->item( + return ! is_null($address->server) ? $this->item( $address->server, new ServerTransformer(), ) : null; } diff --git a/app/Transformers/Admin/CotermTransformer.php b/app/Transformers/Admin/CotermTransformer.php index d366994226e..912d524aedb 100644 --- a/app/Transformers/Admin/CotermTransformer.php +++ b/app/Transformers/Admin/CotermTransformer.php @@ -14,12 +14,12 @@ public function __construct(private bool $includeToken = false) public function transform(Coterm $coterm): array { $transformed = [ - 'id' => (int)$coterm->id, + 'id' => (int) $coterm->id, 'name' => $coterm->name, - 'is_tls_enabled' => (boolean)$coterm->is_tls_enabled, + 'is_tls_enabled' => (bool) $coterm->is_tls_enabled, 'fqdn' => $coterm->fqdn, - 'port' => (int)$coterm->port, - 'nodes_count' => (int)$coterm->nodes_count, + 'port' => (int) $coterm->port, + 'nodes_count' => (int) $coterm->nodes_count, ]; if ($this->includeToken) { diff --git a/app/Transformers/Admin/FileMetadataTransformer.php b/app/Transformers/Admin/FileMetadataTransformer.php index d152da58300..57421a3aa0c 100644 --- a/app/Transformers/Admin/FileMetadataTransformer.php +++ b/app/Transformers/Admin/FileMetadataTransformer.php @@ -2,8 +2,8 @@ namespace Convoy\Transformers\Admin; -use League\Fractal\TransformerAbstract; use Convoy\Data\Node\Storage\FileMetaData; +use League\Fractal\TransformerAbstract; class FileMetadataTransformer extends TransformerAbstract { diff --git a/app/Transformers/Admin/NodeTransformer.php b/app/Transformers/Admin/NodeTransformer.php index 47449c13105..35d03d69d13 100644 --- a/app/Transformers/Admin/NodeTransformer.php +++ b/app/Transformers/Admin/NodeTransformer.php @@ -28,7 +28,7 @@ public function transform(Node $node): array 'iso_storage' => $node->iso_storage, 'network' => $node->network, 'coterm_id' => $node->coterm_id, - 'servers_count' => (int)$node->servers_count, + 'servers_count' => (int) $node->servers_count, ]; } } diff --git a/app/Transformers/Admin/ServerBuildTransformer.php b/app/Transformers/Admin/ServerBuildTransformer.php index cc74ec472db..078acbd5032 100644 --- a/app/Transformers/Admin/ServerBuildTransformer.php +++ b/app/Transformers/Admin/ServerBuildTransformer.php @@ -3,9 +3,9 @@ namespace Convoy\Transformers\Admin; use Convoy\Models\Server; +use Convoy\Services\Servers\ServerDetailService; use Illuminate\Support\Facades\App; use League\Fractal\TransformerAbstract; -use Convoy\Services\Servers\ServerDetailService; class ServerBuildTransformer extends TransformerAbstract { diff --git a/app/Transformers/Client/ActivityLogTransformer.php b/app/Transformers/Client/ActivityLogTransformer.php index 83fff9b8f54..d0a91af6d81 100644 --- a/app/Transformers/Client/ActivityLogTransformer.php +++ b/app/Transformers/Client/ActivityLogTransformer.php @@ -2,12 +2,12 @@ namespace Convoy\Transformers\Client; -use Convoy\Models\User; -use Illuminate\Support\Str; -use Illuminate\Http\Request; use Convoy\Models\ActivityLog; +use Convoy\Models\User; use Illuminate\Container\Container; use Illuminate\Database\Eloquent\Model; +use Illuminate\Http\Request; +use Illuminate\Support\Str; use League\Fractal\TransformerAbstract; class ActivityLogTransformer extends TransformerAbstract diff --git a/app/Transformers/Client/ServerDetailTransformer.php b/app/Transformers/Client/ServerDetailTransformer.php index 0d1ad7f2b6e..1753997c532 100644 --- a/app/Transformers/Client/ServerDetailTransformer.php +++ b/app/Transformers/Client/ServerDetailTransformer.php @@ -2,8 +2,8 @@ namespace Convoy\Transformers\Client; -use League\Fractal\TransformerAbstract; use Convoy\Data\Server\Proxmox\ServerProxmoxData; +use League\Fractal\TransformerAbstract; class ServerDetailTransformer extends TransformerAbstract { diff --git a/app/Transformers/Client/ServerStateTransformer.php b/app/Transformers/Client/ServerStateTransformer.php index 8c3712f3edb..94fe8cb5cb9 100644 --- a/app/Transformers/Client/ServerStateTransformer.php +++ b/app/Transformers/Client/ServerStateTransformer.php @@ -2,8 +2,8 @@ namespace Convoy\Transformers\Client; -use League\Fractal\TransformerAbstract; use Convoy\Data\Server\Proxmox\ServerStateData; +use League\Fractal\TransformerAbstract; class ServerStateTransformer extends TransformerAbstract { diff --git a/app/Transformers/Coterm/NoVncCredentialsTransformer.php b/app/Transformers/Coterm/NoVncCredentialsTransformer.php index 018b082417e..3f8b9f65f11 100644 --- a/app/Transformers/Coterm/NoVncCredentialsTransformer.php +++ b/app/Transformers/Coterm/NoVncCredentialsTransformer.php @@ -2,9 +2,9 @@ namespace Convoy\Transformers\Coterm; +use Convoy\Data\Server\Proxmox\Console\NoVncCredentialsData; use Convoy\Models\Server; use League\Fractal\TransformerAbstract; -use Convoy\Data\Server\Proxmox\Console\NoVncCredentialsData; class NoVncCredentialsTransformer extends TransformerAbstract { diff --git a/app/Transformers/Coterm/XTermCredentialsTransformer.php b/app/Transformers/Coterm/XTermCredentialsTransformer.php index d6bff18c01d..367e6d55e48 100644 --- a/app/Transformers/Coterm/XTermCredentialsTransformer.php +++ b/app/Transformers/Coterm/XTermCredentialsTransformer.php @@ -2,9 +2,9 @@ namespace Convoy\Transformers\Coterm; +use Convoy\Data\Server\Proxmox\Console\XTermCredentialsData; use Convoy\Models\Server; use League\Fractal\TransformerAbstract; -use Convoy\Data\Server\Proxmox\Console\XTermCredentialsData; class XTermCredentialsTransformer extends TransformerAbstract { diff --git a/app/Validation/ValidateAddressType.php b/app/Validation/ValidateAddressType.php index e3c5c7d7c80..6aa2e41a43c 100644 --- a/app/Validation/ValidateAddressType.php +++ b/app/Validation/ValidateAddressType.php @@ -2,12 +2,14 @@ namespace Convoy\Validation; -use Illuminate\Validation\Validator; use Convoy\Enums\Network\AddressType; +use Illuminate\Validation\Validator; class ValidateAddressType { - public function __construct(private AddressType $addressType, private array $fields) {} + public function __construct(private AddressType $addressType, private array $fields) + { + } public function __invoke(Validator $validator) { @@ -27,4 +29,4 @@ public function __invoke(Validator $validator) } } } -} \ No newline at end of file +} diff --git a/app/Validation/ValidateAddressUniqueness.php b/app/Validation/ValidateAddressUniqueness.php index 849f4a9affd..98d67f4eee6 100644 --- a/app/Validation/ValidateAddressUniqueness.php +++ b/app/Validation/ValidateAddressUniqueness.php @@ -15,17 +15,17 @@ public function __invoke(Validator $validator): void { $data = $validator->validated(); - if (!$this->existingAddress) { + if (! $this->existingAddress) { 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/artisan b/artisan index 67a3329b183..8e04b42240f 100644 --- a/artisan +++ b/artisan @@ -1,53 +1,15 @@ #!/usr/bin/env php make(Illuminate\Contracts\Console\Kernel::class); - -$status = $kernel->handle( - $input = new Symfony\Component\Console\Input\ArgvInput, - new Symfony\Component\Console\Output\ConsoleOutput -); - -/* -|-------------------------------------------------------------------------- -| Shutdown The Application -|-------------------------------------------------------------------------- -| -| Once Artisan has finished running, we will fire off the shutdown events -| so that any final work may be done by the application before we shut -| down the process. This is the last thing to happen to the request. -| -*/ - -$kernel->terminate($input, $status); +// Bootstrap Laravel and handle the command... +$status = (require_once __DIR__.'/bootstrap/app.php') + ->handleCommand(new ArgvInput); exit($status); diff --git a/bootstrap/app.php b/bootstrap/app.php index e9bb699579d..93584ab0dba 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -1,55 +1,38 @@ singleton( - Illuminate\Contracts\Http\Kernel::class, - \Convoy\Http\Kernel::class, -); - -$app->singleton( - Illuminate\Contracts\Console\Kernel::class, - Convoy\Console\Kernel::class, -); - -$app->singleton( - Illuminate\Contracts\Debug\ExceptionHandler::class, - Convoy\Exceptions\Handler::class, -); - -/* -|-------------------------------------------------------------------------- -| Return The Application -|-------------------------------------------------------------------------- -| -| This script returns the application instance. The instance is given to -| the calling script so we can separate the building of the instances -| from the actual running of the application and sending responses. -| -*/ - -return $app; +use Convoy\Providers\AppServiceProvider; +use Illuminate\Foundation\Application; +use Illuminate\Foundation\Configuration\Exceptions; +use Illuminate\Foundation\Configuration\Middleware; + +return Application::configure(basePath: dirname(__DIR__)) + ->withProviders() + ->withRouting( + web: __DIR__.'/../routes/web.php', + // api: __DIR__.'/../routes/api.php', + commands: __DIR__.'/../routes/console.php', + channels: __DIR__.'/../routes/channels.php', + health: '/up', + ) + ->withMiddleware(function (Middleware $middleware) { + $middleware->redirectUsersTo(AppServiceProvider::HOME); + + $middleware->append([ + \Convoy\Http\Middleware\TrustProxies::class, + \Convoy\Http\Middleware\PreventRequestsDuringMaintenance::class, + \Convoy\Http\Middleware\TrimStrings::class, + ]); + + $middleware->web([ + \Convoy\Http\Middleware\EncryptCookies::class, + \Convoy\Http\Middleware\VerifyCsrfToken::class, + ]); + + $middleware->alias([ + 'auth' => \Convoy\Http\Middleware\Authenticate::class, + 'guest' => \Convoy\Http\Middleware\RedirectIfAuthenticated::class, + ]); + }) + ->withExceptions(function (Exceptions $exceptions) { + // + })->create(); diff --git a/bootstrap/providers.php b/bootstrap/providers.php new file mode 100644 index 00000000000..dfc24cf1d39 --- /dev/null +++ b/bootstrap/providers.php @@ -0,0 +1,9 @@ + 'canary', - /* - |-------------------------------------------------------------------------- - | Application Name - |-------------------------------------------------------------------------- - | - | This value is the name of your application. This value is used when the - | framework needs to place the application's name in a notification or - | any other location as required by the application or its packages. - | - */ - - 'name' => env('APP_NAME', 'Laravel'), - - /* - |-------------------------------------------------------------------------- - | Application Environment - |-------------------------------------------------------------------------- - | - | This value determines the "environment" your application is currently - | running in. This may determine how you prefer to configure various - | services the application utilizes. Set this in your ".env" file. - | - */ - - 'env' => env('APP_ENV', 'production'), - - /* - |-------------------------------------------------------------------------- - | Application Debug Mode - |-------------------------------------------------------------------------- - | - | When your application is in debug mode, detailed error messages with - | stack traces will be shown on every error that occurs within your - | application. If disabled, a simple generic error page is shown. - | - */ - - 'debug' => (bool) env('APP_DEBUG', false), - - /* - |-------------------------------------------------------------------------- - | Application URL - |-------------------------------------------------------------------------- - | - | This URL is used by the console to properly generate URLs when using - | the Artisan command line tool. You should set this to the root of - | your application so that it is used when running Artisan tasks. - | - */ - - 'url' => env('APP_URL', 'http://localhost'), - - 'asset_url' => env('ASSET_URL'), - - /* - |-------------------------------------------------------------------------- - | Application Timezone - |-------------------------------------------------------------------------- - | - | Here you may specify the default timezone for your application, which - | will be used by the PHP date and date-time functions. We have gone - | ahead and set this to a sensible default for you out of the box. - | - */ - - 'timezone' => 'UTC', - - /* - |-------------------------------------------------------------------------- - | Application Locale Configuration - |-------------------------------------------------------------------------- - | - | The application locale determines the default locale that will be used - | by the translation service provider. You are free to set this value - | to any of the locales which will be supported by the application. - | - */ - - 'locale' => 'en_US', - - /* - |-------------------------------------------------------------------------- - | Application Fallback Locale - |-------------------------------------------------------------------------- - | - | The fallback locale determines the locale to use when the current one - | is not available. You may change the value to correspond to any of - | the language folders that are provided through your application. - | - */ - - 'fallback_locale' => 'en_US', - - /* - |-------------------------------------------------------------------------- - | Faker Locale - |-------------------------------------------------------------------------- - | - | This locale will be used by the Faker PHP library when generating fake - | data for your database seeds. For example, this will be used to get - | localized telephone numbers, street address information and more. - | - */ - - 'faker_locale' => 'en_US', - - /* - |-------------------------------------------------------------------------- - | Encryption Key - |-------------------------------------------------------------------------- - | - | This key is used by the Illuminate encrypter service and should be set - | to a random, 32 character string, otherwise these encrypted strings - | will not be safe. Please do this before deploying an application! - | - */ - - 'key' => env('APP_KEY'), - - 'cipher' => 'AES-256-CBC', - - /* - |-------------------------------------------------------------------------- - | Maintenance Mode Driver - |-------------------------------------------------------------------------- - | - | These configuration options determine the driver used to determine and - | manage Laravel's "maintenance mode" status. The "cache" driver will - | allow maintenance mode to be controlled across multiple machines. - | - | Supported drivers: "file", "cache" - | - */ - - 'maintenance' => [ - 'driver' => 'file', - // 'store' => 'redis', - ], - - /* - |-------------------------------------------------------------------------- - | Autoloaded Service Providers - |-------------------------------------------------------------------------- - | - | The service providers listed here will be automatically loaded on the - | request to your application. Feel free to add your own services to - | this array to grant expanded functionality to your applications. - | - */ - - 'providers' => ServiceProvider::defaultProviders()->merge([ - /* - * Package Service Providers... - */ - - /* - * 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, - ])->toArray(), - - /* - |-------------------------------------------------------------------------- - | Class Aliases - |-------------------------------------------------------------------------- - | - | This array of class aliases will be registered when this application - | is started. However, feel free to register as many as you wish as - | the aliases are "lazy" loaded so they don't hinder performance. - | - */ - 'aliases' => Facade::defaultAliases()->merge([ // Custom Facades 'Activity' => Convoy\Facades\Activity::class, diff --git a/config/auth.php b/config/auth.php deleted file mode 100644 index 0de49c42200..00000000000 --- a/config/auth.php +++ /dev/null @@ -1,115 +0,0 @@ - [ - 'guard' => 'web', - 'passwords' => 'users', - ], - - /* - |-------------------------------------------------------------------------- - | Authentication Guards - |-------------------------------------------------------------------------- - | - | Next, you may define every authentication guard for your application. - | Of course, a great default configuration has been defined for you - | here which uses session storage and the Eloquent user provider. - | - | All authentication drivers have a user provider. This defines how the - | users are actually retrieved out of your database or other storage - | mechanisms used by this application to persist your user's data. - | - | Supported: "session" - | - */ - - 'guards' => [ - 'web' => [ - 'driver' => 'session', - 'provider' => 'users', - ], - ], - - /* - |-------------------------------------------------------------------------- - | User Providers - |-------------------------------------------------------------------------- - | - | All authentication drivers have a user provider. This defines how the - | users are actually retrieved out of your database or other storage - | mechanisms used by this application to persist your user's data. - | - | If you have multiple user tables or models you may configure multiple - | sources which represent each model / table. These sources may then - | be assigned to any extra authentication guards you have defined. - | - | Supported: "database", "eloquent" - | - */ - - 'providers' => [ - 'users' => [ - 'driver' => 'eloquent', - 'model' => Convoy\Models\User::class, - ], - - // 'users' => [ - // 'driver' => 'database', - // 'table' => 'users', - // ], - ], - - /* - |-------------------------------------------------------------------------- - | Resetting Passwords - |-------------------------------------------------------------------------- - | - | You may specify multiple password reset configurations if you have more - | than one user table or model in the application and you want to have - | separate password reset settings based on the specific user types. - | - | The expiry time is the number of minutes that each reset token will be - | considered valid. This security feature keeps tokens short-lived so - | they have less time to be guessed. You may change this as needed. - | - | The throttle setting is the number of seconds a user must wait before - | generating more password reset tokens. This prevents the user from - | quickly generating a very large amount of password reset tokens. - | - */ - - 'passwords' => [ - 'users' => [ - 'provider' => 'users', - 'table' => 'password_reset_tokens', - 'expire' => 60, - 'throttle' => 60, - ], - ], - - /* - |-------------------------------------------------------------------------- - | Password Confirmation Timeout - |-------------------------------------------------------------------------- - | - | Here you may define the amount of seconds before a password confirmation - | times out and the user is prompted to re-enter their password via the - | confirmation screen. By default, the timeout lasts for three hours. - | - */ - - 'password_timeout' => 10800, - -]; diff --git a/config/broadcasting.php b/config/broadcasting.php deleted file mode 100644 index 9e4d4aa44b5..00000000000 --- a/config/broadcasting.php +++ /dev/null @@ -1,70 +0,0 @@ - env('BROADCAST_DRIVER', 'null'), - - /* - |-------------------------------------------------------------------------- - | Broadcast Connections - |-------------------------------------------------------------------------- - | - | Here you may define all of the broadcast connections that will be used - | to broadcast events to other systems or over websockets. Samples of - | each available type of connection are provided inside this array. - | - */ - - 'connections' => [ - - 'pusher' => [ - 'driver' => 'pusher', - 'key' => env('PUSHER_APP_KEY'), - 'secret' => env('PUSHER_APP_SECRET'), - 'app_id' => env('PUSHER_APP_ID'), - 'options' => [ - 'host' => env('PUSHER_HOST') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com', - 'port' => env('PUSHER_PORT', 443), - 'scheme' => env('PUSHER_SCHEME', 'https'), - 'encrypted' => true, - 'useTLS' => env('PUSHER_SCHEME', 'https') === 'https', - ], - 'client_options' => [ - // Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html - ], - ], - - 'ably' => [ - 'driver' => 'ably', - 'key' => env('ABLY_KEY'), - ], - - 'redis' => [ - 'driver' => 'redis', - 'connection' => 'default', - ], - - 'log' => [ - 'driver' => 'log', - ], - - 'null' => [ - 'driver' => 'null', - ], - - ], - -]; diff --git a/config/cache.php b/config/cache.php deleted file mode 100644 index 33bb29546eb..00000000000 --- a/config/cache.php +++ /dev/null @@ -1,110 +0,0 @@ - env('CACHE_DRIVER', 'file'), - - /* - |-------------------------------------------------------------------------- - | Cache Stores - |-------------------------------------------------------------------------- - | - | Here you may define all of the cache "stores" for your application as - | well as their drivers. You may even define multiple stores for the - | same cache driver to group types of items stored in your caches. - | - | Supported drivers: "apc", "array", "database", "file", - | "memcached", "redis", "dynamodb", "octane", "null" - | - */ - - 'stores' => [ - - 'apc' => [ - 'driver' => 'apc', - ], - - 'array' => [ - 'driver' => 'array', - 'serialize' => false, - ], - - 'database' => [ - 'driver' => 'database', - 'table' => 'cache', - 'connection' => null, - 'lock_connection' => null, - ], - - 'file' => [ - 'driver' => 'file', - 'path' => storage_path('framework/cache/data'), - ], - - 'memcached' => [ - 'driver' => 'memcached', - 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'), - 'sasl' => [ - env('MEMCACHED_USERNAME'), - env('MEMCACHED_PASSWORD'), - ], - 'options' => [ - // Memcached::OPT_CONNECT_TIMEOUT => 2000, - ], - 'servers' => [ - [ - 'host' => env('MEMCACHED_HOST', '127.0.0.1'), - 'port' => env('MEMCACHED_PORT', 11211), - 'weight' => 100, - ], - ], - ], - - 'redis' => [ - 'driver' => 'redis', - 'connection' => 'cache', - 'lock_connection' => 'default', - ], - - 'dynamodb' => [ - 'driver' => 'dynamodb', - 'key' => env('AWS_ACCESS_KEY_ID'), - 'secret' => env('AWS_SECRET_ACCESS_KEY'), - 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), - 'table' => env('DYNAMODB_CACHE_TABLE', 'cache'), - 'endpoint' => env('DYNAMODB_ENDPOINT'), - ], - - 'octane' => [ - 'driver' => 'octane', - ], - - ], - - /* - |-------------------------------------------------------------------------- - | Cache Key Prefix - |-------------------------------------------------------------------------- - | - | When utilizing the APC, database, memcached, Redis, or DynamoDB cache - | stores there might be other applications using the same cache. For - | that reason, you may prefix every cache key to avoid collisions. - | - */ - - 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache_'), - -]; diff --git a/config/cors.php b/config/cors.php deleted file mode 100644 index 8a39e6daa63..00000000000 --- a/config/cors.php +++ /dev/null @@ -1,34 +0,0 @@ - ['api/*', 'sanctum/csrf-cookie'], - - 'allowed_methods' => ['*'], - - 'allowed_origins' => ['*'], - - 'allowed_origins_patterns' => [], - - 'allowed_headers' => ['*'], - - 'exposed_headers' => [], - - 'max_age' => 0, - - 'supports_credentials' => false, - -]; diff --git a/config/database.php b/config/database.php index 137ad18ce38..1fc80662a4d 100644 --- a/config/database.php +++ b/config/database.php @@ -1,151 +1,10 @@ env('DB_CONNECTION', 'mysql'), - - /* - |-------------------------------------------------------------------------- - | Database Connections - |-------------------------------------------------------------------------- - | - | Here are each of the database connections setup for your application. - | Of course, examples of configuring each database platform that is - | supported by Laravel is shown below to make development simple. - | - | - | All database work in Laravel is done through the PHP PDO facilities - | so make sure you have the driver for your particular database of - | choice installed on your machine before you begin development. - | - */ - - 'connections' => [ - - 'sqlite' => [ - 'driver' => 'sqlite', - 'url' => env('DATABASE_URL'), - 'database' => env('DB_DATABASE', database_path('database.sqlite')), - 'prefix' => '', - 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true), - ], - - 'mysql' => [ - 'driver' => 'mysql', - 'url' => env('DATABASE_URL'), - 'host' => env('DB_HOST', '127.0.0.1'), - 'port' => env('DB_PORT', '3306'), - 'database' => env('DB_DATABASE', 'forge'), - 'username' => env('DB_USERNAME', 'forge'), - 'password' => env('DB_PASSWORD', ''), - 'unix_socket' => env('DB_SOCKET', ''), - 'charset' => 'utf8mb4', - 'collation' => 'utf8mb4_unicode_ci', - 'prefix' => '', - 'prefix_indexes' => true, - 'strict' => true, - 'engine' => null, - 'options' => extension_loaded('pdo_mysql') ? array_filter([ - PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), - ]) : [], - ], - - 'pgsql' => [ - 'driver' => 'pgsql', - 'url' => env('DATABASE_URL'), - 'host' => env('DB_HOST', '127.0.0.1'), - 'port' => env('DB_PORT', '5432'), - 'database' => env('DB_DATABASE', 'forge'), - 'username' => env('DB_USERNAME', 'forge'), - 'password' => env('DB_PASSWORD', ''), - 'charset' => 'utf8', - 'prefix' => '', - 'prefix_indexes' => true, - 'search_path' => 'public', - 'sslmode' => 'prefer', - ], - - 'sqlsrv' => [ - 'driver' => 'sqlsrv', - 'url' => env('DATABASE_URL'), - 'host' => env('DB_HOST', 'localhost'), - 'port' => env('DB_PORT', '1433'), - 'database' => env('DB_DATABASE', 'forge'), - 'username' => env('DB_USERNAME', 'forge'), - 'password' => env('DB_PASSWORD', ''), - 'charset' => 'utf8', - 'prefix' => '', - 'prefix_indexes' => true, - // 'encrypt' => env('DB_ENCRYPT', 'yes'), - // 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'), - ], - - ], - - /* - |-------------------------------------------------------------------------- - | Migration Repository Table - |-------------------------------------------------------------------------- - | - | This table keeps track of all the migrations that have already run for - | your application. Using this information, we can determine which of - | the migrations on disk haven't actually been run in the database. - | - */ - - 'migrations' => 'migrations', - - /* - |-------------------------------------------------------------------------- - | Redis Databases - |-------------------------------------------------------------------------- - | - | Redis is an open source, fast, and advanced key-value store that also - | provides a richer body of commands than a typical key-value system - | such as APC or Memcached. Laravel makes it easy to dig right in. - | - */ - - 'redis' => [ - - 'client' => env('REDIS_CLIENT', 'phpredis'), - - 'options' => [ - 'cluster' => env('REDIS_CLUSTER', 'redis'), - 'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'), - ], - - 'default' => [ - 'url' => env('REDIS_URL'), - 'host' => env('REDIS_HOST', '127.0.0.1'), - 'username' => env('REDIS_USERNAME'), - 'password' => env('REDIS_PASSWORD'), - 'port' => env('REDIS_PORT', '6379'), - 'database' => env('REDIS_DB', '0'), - ], - - 'cache' => [ - 'url' => env('REDIS_URL'), - 'host' => env('REDIS_HOST', '127.0.0.1'), - 'username' => env('REDIS_USERNAME'), - 'password' => env('REDIS_PASSWORD'), - 'port' => env('REDIS_PORT', '6379'), - 'database' => env('REDIS_CACHE_DB', '1'), - ], - + 'migrations' => [ + 'table' => 'migrations', + 'update_date_on_publish' => false, // disable to preserve original behavior for existing applications ], ]; diff --git a/config/filesystems.php b/config/filesystems.php deleted file mode 100644 index e9d9dbdbe8a..00000000000 --- a/config/filesystems.php +++ /dev/null @@ -1,76 +0,0 @@ - env('FILESYSTEM_DISK', 'local'), - - /* - |-------------------------------------------------------------------------- - | Filesystem Disks - |-------------------------------------------------------------------------- - | - | Here you may configure as many filesystem "disks" as you wish, and you - | may even configure multiple disks of the same driver. Defaults have - | been set up for each driver as an example of the required values. - | - | Supported Drivers: "local", "ftp", "sftp", "s3" - | - */ - - 'disks' => [ - - 'local' => [ - 'driver' => 'local', - 'root' => storage_path('app'), - 'throw' => false, - ], - - 'public' => [ - 'driver' => 'local', - 'root' => storage_path('app/public'), - 'url' => env('APP_URL').'/storage', - 'visibility' => 'public', - 'throw' => false, - ], - - 's3' => [ - 'driver' => 's3', - 'key' => env('AWS_ACCESS_KEY_ID'), - 'secret' => env('AWS_SECRET_ACCESS_KEY'), - 'region' => env('AWS_DEFAULT_REGION'), - 'bucket' => env('AWS_BUCKET'), - 'url' => env('AWS_URL'), - 'endpoint' => env('AWS_ENDPOINT'), - 'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false), - 'throw' => false, - ], - - ], - - /* - |-------------------------------------------------------------------------- - | Symbolic Links - |-------------------------------------------------------------------------- - | - | Here you may configure the symbolic links that will be created when the - | `storage:link` Artisan command is executed. The array keys should be - | the locations of the links and the values should be their targets. - | - */ - - 'links' => [ - public_path('storage') => storage_path('app/public'), - ], - -]; diff --git a/config/fortify.php b/config/fortify.php index 358fc33d88a..856fb8fd3cf 100644 --- a/config/fortify.php +++ b/config/fortify.php @@ -1,5 +1,6 @@ RouteServiceProvider::HOME, + 'home' => AppServiceProvider::HOME, /* |-------------------------------------------------------------------------- diff --git a/config/hashing.php b/config/hashing.php deleted file mode 100644 index bcd3be4c28a..00000000000 --- a/config/hashing.php +++ /dev/null @@ -1,52 +0,0 @@ - 'bcrypt', - - /* - |-------------------------------------------------------------------------- - | Bcrypt Options - |-------------------------------------------------------------------------- - | - | Here you may specify the configuration options that should be used when - | passwords are hashed using the Bcrypt algorithm. This will allow you - | to control the amount of time it takes to hash the given password. - | - */ - - 'bcrypt' => [ - 'rounds' => env('BCRYPT_ROUNDS', 10), - ], - - /* - |-------------------------------------------------------------------------- - | Argon Options - |-------------------------------------------------------------------------- - | - | Here you may specify the configuration options that should be used when - | passwords are hashed using the Argon algorithm. These will allow you - | to control the amount of time it takes to hash the given password. - | - */ - - 'argon' => [ - 'memory' => 65536, - 'threads' => 1, - 'time' => 4, - ], - -]; diff --git a/config/logging.php b/config/logging.php deleted file mode 100644 index c44d27639aa..00000000000 --- a/config/logging.php +++ /dev/null @@ -1,131 +0,0 @@ - env('LOG_CHANNEL', 'stack'), - - /* - |-------------------------------------------------------------------------- - | Deprecations Log Channel - |-------------------------------------------------------------------------- - | - | This option controls the log channel that should be used to log warnings - | regarding deprecated PHP and library features. This allows you to get - | your application ready for upcoming major versions of dependencies. - | - */ - - 'deprecations' => [ - 'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'), - 'trace' => false, - ], - - /* - |-------------------------------------------------------------------------- - | Log Channels - |-------------------------------------------------------------------------- - | - | Here you may configure the log channels for your application. Out of - | the box, Laravel uses the Monolog PHP logging library. This gives - | you a variety of powerful log handlers / formatters to utilize. - | - | Available Drivers: "single", "daily", "slack", "syslog", - | "errorlog", "monolog", - | "custom", "stack" - | - */ - - 'channels' => [ - 'stack' => [ - 'driver' => 'stack', - 'channels' => ['single'], - 'ignore_exceptions' => false, - ], - - 'single' => [ - 'driver' => 'single', - 'path' => storage_path('logs/laravel.log'), - 'level' => env('LOG_LEVEL', 'debug'), - 'replace_placeholders' => true, - ], - - 'daily' => [ - 'driver' => 'daily', - 'path' => storage_path('logs/laravel.log'), - 'level' => env('LOG_LEVEL', 'debug'), - 'days' => 14, - 'replace_placeholders' => true, - ], - - 'slack' => [ - 'driver' => 'slack', - 'url' => env('LOG_SLACK_WEBHOOK_URL'), - 'username' => 'Laravel Log', - 'emoji' => ':boom:', - 'level' => env('LOG_LEVEL', 'critical'), - 'replace_placeholders' => true, - ], - - 'papertrail' => [ - 'driver' => 'monolog', - 'level' => env('LOG_LEVEL', 'debug'), - 'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class), - 'handler_with' => [ - 'host' => env('PAPERTRAIL_URL'), - 'port' => env('PAPERTRAIL_PORT'), - 'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'), - ], - 'processors' => [PsrLogMessageProcessor::class], - ], - - 'stderr' => [ - 'driver' => 'monolog', - 'level' => env('LOG_LEVEL', 'debug'), - 'handler' => StreamHandler::class, - 'formatter' => env('LOG_STDERR_FORMATTER'), - 'with' => [ - 'stream' => 'php://stderr', - ], - 'processors' => [PsrLogMessageProcessor::class], - ], - - 'syslog' => [ - 'driver' => 'syslog', - 'level' => env('LOG_LEVEL', 'debug'), - 'facility' => LOG_USER, - 'replace_placeholders' => true, - ], - - 'errorlog' => [ - 'driver' => 'errorlog', - 'level' => env('LOG_LEVEL', 'debug'), - 'replace_placeholders' => true, - ], - - 'null' => [ - 'driver' => 'monolog', - 'handler' => NullHandler::class, - ], - - 'emergency' => [ - 'path' => storage_path('logs/laravel.log'), - ], - ], - -]; diff --git a/config/mail.php b/config/mail.php index 542d98c37c4..77815a61977 100644 --- a/config/mail.php +++ b/config/mail.php @@ -2,123 +2,13 @@ return [ - /* - |-------------------------------------------------------------------------- - | Default Mailer - |-------------------------------------------------------------------------- - | - | This option controls the default mailer that is used to send any email - | messages sent by your application. Alternative mailers may be setup - | and used as needed; however, this mailer will be used by default. - | - */ - - 'default' => env('MAIL_MAILER', 'smtp'), - - /* - |-------------------------------------------------------------------------- - | Mailer Configurations - |-------------------------------------------------------------------------- - | - | Here you may configure all of the mailers used by your application plus - | their respective settings. Several examples have been configured for - | you and you are free to add your own as your application requires. - | - | Laravel supports a variety of mail "transport" drivers to be used while - | sending an e-mail. You will specify which one you are using for your - | mailers below. You are free to add additional mailers as required. - | - | Supported: "smtp", "sendmail", "mailgun", "ses", "ses-v2", - | "postmark", "log", "array", "failover" - | - */ - 'mailers' => [ - 'smtp' => [ - 'transport' => 'smtp', - 'host' => env('MAIL_HOST', 'smtp.mailgun.org'), - 'port' => env('MAIL_PORT', 587), - 'encryption' => env('MAIL_ENCRYPTION', 'tls'), - 'username' => env('MAIL_USERNAME'), - 'password' => env('MAIL_PASSWORD'), - 'timeout' => null, - 'local_domain' => env('MAIL_EHLO_DOMAIN'), - ], - - 'ses' => [ - 'transport' => 'ses', - ], - 'mailgun' => [ 'transport' => 'mailgun', // 'client' => [ // 'timeout' => 5, // ], ], - - 'postmark' => [ - 'transport' => 'postmark', - // 'client' => [ - // 'timeout' => 5, - // ], - ], - - 'sendmail' => [ - 'transport' => 'sendmail', - 'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'), - ], - - 'log' => [ - 'transport' => 'log', - 'channel' => env('MAIL_LOG_CHANNEL'), - ], - - 'array' => [ - 'transport' => 'array', - ], - - 'failover' => [ - 'transport' => 'failover', - 'mailers' => [ - 'smtp', - 'log', - ], - ], - ], - - /* - |-------------------------------------------------------------------------- - | Global "From" Address - |-------------------------------------------------------------------------- - | - | You may wish for all e-mails sent by your application to be sent from - | the same address. Here, you may specify a name and address that is - | used globally for all e-mails that are sent by your application. - | - */ - - 'from' => [ - 'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'), - 'name' => env('MAIL_FROM_NAME', 'Example'), - ], - - /* - |-------------------------------------------------------------------------- - | Markdown Mail Settings - |-------------------------------------------------------------------------- - | - | If you are using Markdown based email rendering, you may configure your - | theme and component paths here, allowing you to customize the design - | of the emails. Or, you may simply stick with the Laravel defaults! - | - */ - - 'markdown' => [ - 'theme' => 'default', - - 'paths' => [ - resource_path('views/vendor/mail'), - ], ], ]; diff --git a/config/queue.php b/config/queue.php deleted file mode 100644 index 25ea5a81935..00000000000 --- a/config/queue.php +++ /dev/null @@ -1,93 +0,0 @@ - env('QUEUE_CONNECTION', 'sync'), - - /* - |-------------------------------------------------------------------------- - | Queue Connections - |-------------------------------------------------------------------------- - | - | Here you may configure the connection information for each server that - | is used by your application. A default configuration has been added - | for each back-end shipped with Laravel. You are free to add more. - | - | Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null" - | - */ - - 'connections' => [ - - 'sync' => [ - 'driver' => 'sync', - ], - - 'database' => [ - 'driver' => 'database', - 'table' => 'jobs', - 'queue' => 'default', - 'retry_after' => 90, - 'after_commit' => false, - ], - - 'beanstalkd' => [ - 'driver' => 'beanstalkd', - 'host' => 'localhost', - 'queue' => 'default', - 'retry_after' => 90, - 'block_for' => 0, - 'after_commit' => false, - ], - - 'sqs' => [ - 'driver' => 'sqs', - 'key' => env('AWS_ACCESS_KEY_ID'), - 'secret' => env('AWS_SECRET_ACCESS_KEY'), - 'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'), - 'queue' => env('SQS_QUEUE', 'default'), - 'suffix' => env('SQS_SUFFIX'), - 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), - 'after_commit' => false, - ], - - 'redis' => [ - 'driver' => 'redis', - 'connection' => 'default', - 'queue' => env('REDIS_QUEUE', 'default'), - 'retry_after' => 90, - 'block_for' => null, - 'after_commit' => false, - ], - - ], - - /* - |-------------------------------------------------------------------------- - | Failed Queue Jobs - |-------------------------------------------------------------------------- - | - | These options configure the behavior of failed queue job logging so you - | can control which database and table are used to store the jobs that - | have failed. You may change them to any database / table you wish. - | - */ - - 'failed' => [ - 'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'), - 'database' => env('DB_CONNECTION', 'mysql'), - 'table' => 'failed_jobs', - ], - -]; diff --git a/config/sanctum.php b/config/sanctum.php index fe42ff32256..67f7b067925 100644 --- a/config/sanctum.php +++ b/config/sanctum.php @@ -17,12 +17,12 @@ 'stateful' => explode( ',', env( - 'SANCTUM_STATEFUL_DOMAINS', sprintf( - '%s%s', - 'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1', - Sanctum::currentApplicationUrlWithPort(), - ), - ), + 'SANCTUM_STATEFUL_DOMAINS', sprintf( + '%s%s', + 'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1', + Sanctum::currentApplicationUrlWithPort(), + ), + ), ), /* @@ -64,8 +64,8 @@ */ 'middleware' => [ - 'verify_csrf_token' => \Convoy\Http\Middleware\VerifyCsrfToken::class, - 'encrypt_cookies' => \Convoy\Http\Middleware\EncryptCookies::class, + 'validate_csrf_token' => Illuminate\Foundation\Http\Middleware\ValidateCsrfToken::class, + 'encrypt_cookies' => Illuminate\Cookie\Middleware\EncryptCookies::class, ], ]; diff --git a/config/services.php b/config/services.php index 0ace530e8d2..62e0a08a8b8 100644 --- a/config/services.php +++ b/config/services.php @@ -2,18 +2,6 @@ return [ - /* - |-------------------------------------------------------------------------- - | Third Party Services - |-------------------------------------------------------------------------- - | - | This file is for storing the credentials for third party services such - | as Mailgun, Postmark, AWS and more. This file provides the de facto - | location for this type of information, allowing packages to have - | a conventional file to locate the various service credentials. - | - */ - 'mailgun' => [ 'domain' => env('MAILGUN_DOMAIN'), 'secret' => env('MAILGUN_SECRET'), @@ -21,14 +9,4 @@ 'scheme' => 'https', ], - 'postmark' => [ - 'token' => env('POSTMARK_TOKEN'), - ], - - 'ses' => [ - 'key' => env('AWS_ACCESS_KEY_ID'), - 'secret' => env('AWS_SECRET_ACCESS_KEY'), - 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), - ], - ]; diff --git a/config/session.php b/config/session.php deleted file mode 100644 index 8fed97c0141..00000000000 --- a/config/session.php +++ /dev/null @@ -1,201 +0,0 @@ - env('SESSION_DRIVER', 'file'), - - /* - |-------------------------------------------------------------------------- - | Session Lifetime - |-------------------------------------------------------------------------- - | - | Here you may specify the number of minutes that you wish the session - | to be allowed to remain idle before it expires. If you want them - | to immediately expire on the browser closing, set that option. - | - */ - - 'lifetime' => env('SESSION_LIFETIME', 120), - - 'expire_on_close' => false, - - /* - |-------------------------------------------------------------------------- - | Session Encryption - |-------------------------------------------------------------------------- - | - | This option allows you to easily specify that all of your session data - | should be encrypted before it is stored. All encryption will be run - | automatically by Laravel and you can use the Session like normal. - | - */ - - 'encrypt' => false, - - /* - |-------------------------------------------------------------------------- - | Session File Location - |-------------------------------------------------------------------------- - | - | When using the native session driver, we need a location where session - | files may be stored. A default has been set for you but a different - | location may be specified. This is only needed for file sessions. - | - */ - - 'files' => storage_path('framework/sessions'), - - /* - |-------------------------------------------------------------------------- - | Session Database Connection - |-------------------------------------------------------------------------- - | - | When using the "database" or "redis" session drivers, you may specify a - | connection that should be used to manage these sessions. This should - | correspond to a connection in your database configuration options. - | - */ - - 'connection' => env('SESSION_CONNECTION'), - - /* - |-------------------------------------------------------------------------- - | Session Database Table - |-------------------------------------------------------------------------- - | - | When using the "database" session driver, you may specify the table we - | should use to manage the sessions. Of course, a sensible default is - | provided for you; however, you are free to change this as needed. - | - */ - - 'table' => 'sessions', - - /* - |-------------------------------------------------------------------------- - | Session Cache Store - |-------------------------------------------------------------------------- - | - | While using one of the framework's cache driven session backends you may - | list a cache store that should be used for these sessions. This value - | must match with one of the application's configured cache "stores". - | - | Affects: "apc", "dynamodb", "memcached", "redis" - | - */ - - 'store' => env('SESSION_STORE'), - - /* - |-------------------------------------------------------------------------- - | Session Sweeping Lottery - |-------------------------------------------------------------------------- - | - | Some session drivers must manually sweep their storage location to get - | rid of old sessions from storage. Here are the chances that it will - | happen on a given request. By default, the odds are 2 out of 100. - | - */ - - 'lottery' => [2, 100], - - /* - |-------------------------------------------------------------------------- - | Session Cookie Name - |-------------------------------------------------------------------------- - | - | Here you may change the name of the cookie used to identify a session - | instance by ID. The name specified here will get used every time a - | new session cookie is created by the framework for every driver. - | - */ - - 'cookie' => env( - 'SESSION_COOKIE', - Str::slug(env('APP_NAME', 'laravel'), '_').'_session' - ), - - /* - |-------------------------------------------------------------------------- - | Session Cookie Path - |-------------------------------------------------------------------------- - | - | The session cookie path determines the path for which the cookie will - | be regarded as available. Typically, this will be the root path of - | your application but you are free to change this when necessary. - | - */ - - 'path' => '/', - - /* - |-------------------------------------------------------------------------- - | Session Cookie Domain - |-------------------------------------------------------------------------- - | - | Here you may change the domain of the cookie used to identify a session - | in your application. This will determine which domains the cookie is - | available to in your application. A sensible default has been set. - | - */ - - 'domain' => env('SESSION_DOMAIN'), - - /* - |-------------------------------------------------------------------------- - | HTTPS Only Cookies - |-------------------------------------------------------------------------- - | - | By setting this option to true, session cookies will only be sent back - | to the server if the browser has a HTTPS connection. This will keep - | the cookie from being sent to you when it can't be done securely. - | - */ - - 'secure' => env('SESSION_SECURE_COOKIE'), - - /* - |-------------------------------------------------------------------------- - | HTTP Access Only - |-------------------------------------------------------------------------- - | - | Setting this value to true will prevent JavaScript from accessing the - | value of the cookie and the cookie will only be accessible through - | the HTTP protocol. You are free to modify this option if needed. - | - */ - - 'http_only' => true, - - /* - |-------------------------------------------------------------------------- - | Same-Site Cookies - |-------------------------------------------------------------------------- - | - | This option determines how your cookies behave when cross-site requests - | take place, and can be used to mitigate CSRF attacks. By default, we - | will set this value to "lax" since this is a secure default value. - | - | Supported: "lax", "strict", "none", null - | - */ - - 'same_site' => 'lax', - -]; diff --git a/config/view.php b/config/view.php deleted file mode 100644 index 22b8a18d325..00000000000 --- a/config/view.php +++ /dev/null @@ -1,36 +0,0 @@ - [ - resource_path('views'), - ], - - /* - |-------------------------------------------------------------------------- - | Compiled View Path - |-------------------------------------------------------------------------- - | - | This option determines where all the compiled Blade templates will be - | stored for your application. Typically, this is within the storage - | directory. However, as usual, you are free to change this value. - | - */ - - 'compiled' => env( - 'VIEW_COMPILED_PATH', - realpath(storage_path('framework/views')) - ), - -]; diff --git a/database/factories/AddressFactory.php b/database/factories/AddressFactory.php index 8890afd2191..d24f133335b 100644 --- a/database/factories/AddressFactory.php +++ b/database/factories/AddressFactory.php @@ -18,13 +18,13 @@ class AddressFactory extends Factory public function definition(): array { $type = $this->faker->randomElement(['ipv4', 'ipv6']); - + return [ 'type' => $type, - 'address' => $type === 'ipv4' ? $this->faker->ipv4 : $this->faker->ipv6, + 'address' => $type === 'ipv4' ? $this->faker->ipv4() : $this->faker->ipv6(), 'cidr' => $this->faker->numberBetween(0, 128), - 'gateway' => $type === 'ipv4' ? $this->faker->ipv4 : $this->faker->ipv6, - 'mac_address' => $this->faker->randomElement([null, $this->faker->macAddress]), + 'gateway' => $type === 'ipv4' ? $this->faker->ipv4() : $this->faker->ipv6(), + 'mac_address' => $this->faker->randomElement([null, $this->faker->macAddress()]), ]; } } diff --git a/database/migrations/2014_10_12_000000_create_users_table.php b/database/migrations/2014_10_12_000000_create_users_table.php index 6c0eff793f8..de938e04c80 100644 --- a/database/migrations/2014_10_12_000000_create_users_table.php +++ b/database/migrations/2014_10_12_000000_create_users_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2014_10_12_100000_create_password_resets_table.php b/database/migrations/2014_10_12_100000_create_password_resets_table.php index 4f42fe6909e..6733802c7c8 100644 --- a/database/migrations/2014_10_12_100000_create_password_resets_table.php +++ b/database/migrations/2014_10_12_100000_create_password_resets_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2014_10_12_200000_add_two_factor_columns_to_users_table.php b/database/migrations/2014_10_12_200000_add_two_factor_columns_to_users_table.php index 5cc9f78b1b6..cf824d68afb 100644 --- a/database/migrations/2014_10_12_200000_add_two_factor_columns_to_users_table.php +++ b/database/migrations/2014_10_12_200000_add_two_factor_columns_to_users_table.php @@ -5,8 +5,7 @@ use Illuminate\Support\Facades\Schema; use Laravel\Fortify\Fortify; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2019_08_19_000000_create_failed_jobs_table.php b/database/migrations/2019_08_19_000000_create_failed_jobs_table.php index 249da8171ac..51aaa6f9fc4 100644 --- a/database/migrations/2019_08_19_000000_create_failed_jobs_table.php +++ b/database/migrations/2019_08_19_000000_create_failed_jobs_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php b/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php index e43a6a6c2ca..64872a2541a 100644 --- a/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php +++ b/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2022_07_14_232223_nodes_table.php b/database/migrations/2022_07_14_232223_nodes_table.php index 68a72752f5e..1144665e242 100644 --- a/database/migrations/2022_07_14_232223_nodes_table.php +++ b/database/migrations/2022_07_14_232223_nodes_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2022_07_14_232304_servers_table.php b/database/migrations/2022_07_14_232304_servers_table.php index 4b8c283282e..0f4838ba064 100644 --- a/database/migrations/2022_07_14_232304_servers_table.php +++ b/database/migrations/2022_07_14_232304_servers_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2022_07_22_004345_add_ip_address_column_to_servers_table.php b/database/migrations/2022_07_22_004345_add_ip_address_column_to_servers_table.php index da5841a08b2..a807bbb02c6 100644 --- a/database/migrations/2022_07_22_004345_add_ip_address_column_to_servers_table.php +++ b/database/migrations/2022_07_22_004345_add_ip_address_column_to_servers_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2022_07_23_233402_remove_old_columns_from_servers_table.php b/database/migrations/2022_07_23_233402_remove_old_columns_from_servers_table.php index 9a0503e6a12..81ee0b77a78 100644 --- a/database/migrations/2022_07_23_233402_remove_old_columns_from_servers_table.php +++ b/database/migrations/2022_07_23_233402_remove_old_columns_from_servers_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2022_07_24_023016_add_make_template_visible_column_to_servers_table.php b/database/migrations/2022_07_24_023016_add_make_template_visible_column_to_servers_table.php index 7b33e3b6ddf..168380b7ae4 100644 --- a/database/migrations/2022_07_24_023016_add_make_template_visible_column_to_servers_table.php +++ b/database/migrations/2022_07_24_023016_add_make_template_visible_column_to_servers_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2022_07_25_015911_add_is_installing_column_to_servers_table.php b/database/migrations/2022_07_25_015911_add_is_installing_column_to_servers_table.php index 46b12a848ea..f8cdf3a2562 100644 --- a/database/migrations/2022_07_25_015911_add_is_installing_column_to_servers_table.php +++ b/database/migrations/2022_07_25_015911_add_is_installing_column_to_servers_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2022_07_25_025600_create_templates_table.php b/database/migrations/2022_07_25_025600_create_templates_table.php index 3e025f1639f..dbe34f66778 100644 --- a/database/migrations/2022_07_25_025600_create_templates_table.php +++ b/database/migrations/2022_07_25_025600_create_templates_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2022_07_25_025928_remove_template_columns_from_servers_table.php b/database/migrations/2022_07_25_025928_remove_template_columns_from_servers_table.php index b29510a49cc..ca1bf0323af 100644 --- a/database/migrations/2022_07_25_025928_remove_template_columns_from_servers_table.php +++ b/database/migrations/2022_07_25_025928_remove_template_columns_from_servers_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2022_07_25_030214_remove_is_template_column_from_templates_table.php b/database/migrations/2022_07_25_030214_remove_is_template_column_from_templates_table.php index 1036cdcc0a0..884b1d092b0 100644 --- a/database/migrations/2022_07_25_030214_remove_is_template_column_from_templates_table.php +++ b/database/migrations/2022_07_25_030214_remove_is_template_column_from_templates_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2022_07_25_030354_rename_make_templates_visible_column_in_templates_table.php b/database/migrations/2022_07_25_030354_rename_make_templates_visible_column_in_templates_table.php index b62c2e5439b..677147481ab 100644 --- a/database/migrations/2022_07_25_030354_rename_make_templates_visible_column_in_templates_table.php +++ b/database/migrations/2022_07_25_030354_rename_make_templates_visible_column_in_templates_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2022_07_26_003508_create_i_p_addresses_table.php b/database/migrations/2022_07_26_003508_create_i_p_addresses_table.php index 46edacb97df..763ed717b8e 100644 --- a/database/migrations/2022_07_26_003508_create_i_p_addresses_table.php +++ b/database/migrations/2022_07_26_003508_create_i_p_addresses_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2022_07_26_004509_remove_ip_address_column_from_servers_table.php b/database/migrations/2022_07_26_004509_remove_ip_address_column_from_servers_table.php index 09ccf8e197a..242988b9167 100644 --- a/database/migrations/2022_07_26_004509_remove_ip_address_column_from_servers_table.php +++ b/database/migrations/2022_07_26_004509_remove_ip_address_column_from_servers_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2022_07_26_005058_fix_ip_addresses_table_columns.php b/database/migrations/2022_07_26_005058_fix_ip_addresses_table_columns.php index 8d5488f9554..0090fca4780 100644 --- a/database/migrations/2022_07_26_005058_fix_ip_addresses_table_columns.php +++ b/database/migrations/2022_07_26_005058_fix_ip_addresses_table_columns.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2022_07_27_001056_clear_server_id_on_server_delete_in_ip_tables.php b/database/migrations/2022_07_27_001056_clear_server_id_on_server_delete_in_ip_tables.php index 903090828e2..a5dc394859d 100644 --- a/database/migrations/2022_07_27_001056_clear_server_id_on_server_delete_in_ip_tables.php +++ b/database/migrations/2022_07_27_001056_clear_server_id_on_server_delete_in_ip_tables.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2022_07_28_010809_change_subnet_column_to_cid_in_ip_addresses_table.php b/database/migrations/2022_07_28_010809_change_subnet_column_to_cid_in_ip_addresses_table.php index 091da063855..870c526731b 100644 --- a/database/migrations/2022_07_28_010809_change_subnet_column_to_cid_in_ip_addresses_table.php +++ b/database/migrations/2022_07_28_010809_change_subnet_column_to_cid_in_ip_addresses_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2022_07_31_152015_create_sso_tokens_table.php b/database/migrations/2022_07_31_152015_create_sso_tokens_table.php index 1b47e8ff54c..92d829a8466 100644 --- a/database/migrations/2022_07_31_152015_create_sso_tokens_table.php +++ b/database/migrations/2022_07_31_152015_create_sso_tokens_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2022_08_02_042345_replace_is_installing_column_with_installing_in_servers_table.php b/database/migrations/2022_08_02_042345_replace_is_installing_column_with_installing_in_servers_table.php index 64b330c16a8..ddcd13fcf26 100644 --- a/database/migrations/2022_08_02_042345_replace_is_installing_column_with_installing_in_servers_table.php +++ b/database/migrations/2022_08_02_042345_replace_is_installing_column_with_installing_in_servers_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2022_08_04_052834_add_api_key_columns_to_nodes_table.php b/database/migrations/2022_08_04_052834_add_api_key_columns_to_nodes_table.php index ddf6c03708e..554093ecd70 100644 --- a/database/migrations/2022_08_04_052834_add_api_key_columns_to_nodes_table.php +++ b/database/migrations/2022_08_04_052834_add_api_key_columns_to_nodes_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2022_08_09_003453_remove_username_password_columns_from_nodes_table.php b/database/migrations/2022_08_09_003453_remove_username_password_columns_from_nodes_table.php index 87cdfd5ff2b..29bca6aa200 100644 --- a/database/migrations/2022_08_09_003453_remove_username_password_columns_from_nodes_table.php +++ b/database/migrations/2022_08_09_003453_remove_username_password_columns_from_nodes_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2022_08_09_003757_remove_auth_type_column_from_nodes_table.php b/database/migrations/2022_08_09_003757_remove_auth_type_column_from_nodes_table.php index 56292e22fdb..46b32432a95 100644 --- a/database/migrations/2022_08_09_003757_remove_auth_type_column_from_nodes_table.php +++ b/database/migrations/2022_08_09_003757_remove_auth_type_column_from_nodes_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2022_08_09_194438_add_mac_address_column_to_ip_addresses_table.php b/database/migrations/2022_08_09_194438_add_mac_address_column_to_ip_addresses_table.php index 7ff668261ea..e2feda33ac6 100644 --- a/database/migrations/2022_08_09_194438_add_mac_address_column_to_ip_addresses_table.php +++ b/database/migrations/2022_08_09_194438_add_mac_address_column_to_ip_addresses_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2022_09_08_031709_create_activity_logs_table.php b/database/migrations/2022_09_08_031709_create_activity_logs_table.php index 6c03cb7ac6d..fa9a1074498 100644 --- a/database/migrations/2022_09_08_031709_create_activity_logs_table.php +++ b/database/migrations/2022_09_08_031709_create_activity_logs_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2022_09_09_214058_create_activity_log_subjects_table.php b/database/migrations/2022_09_09_214058_create_activity_log_subjects_table.php index 9d24d640491..485ad53e3ad 100644 --- a/database/migrations/2022_09_09_214058_create_activity_log_subjects_table.php +++ b/database/migrations/2022_09_09_214058_create_activity_log_subjects_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2022_09_25_133215_add_limits_to_servers_table.php b/database/migrations/2022_09_25_133215_add_limits_to_servers_table.php index 2f89f4fbbeb..5eb38721611 100644 --- a/database/migrations/2022_09_25_133215_add_limits_to_servers_table.php +++ b/database/migrations/2022_09_25_133215_add_limits_to_servers_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2022_09_25_135328_add_network_and_storage_columns_to_nodes_table.php b/database/migrations/2022_09_25_135328_add_network_and_storage_columns_to_nodes_table.php index f67910d2ff0..2dc6b694626 100644 --- a/database/migrations/2022_09_25_135328_add_network_and_storage_columns_to_nodes_table.php +++ b/database/migrations/2022_09_25_135328_add_network_and_storage_columns_to_nodes_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2022_10_08_035450_add_uuid_columns_to_servers_table.php b/database/migrations/2022_10_08_035450_add_uuid_columns_to_servers_table.php index c92e7d08868..9967cc548cd 100644 --- a/database/migrations/2022_10_08_035450_add_uuid_columns_to_servers_table.php +++ b/database/migrations/2022_10_08_035450_add_uuid_columns_to_servers_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2022_10_16_134515_add_bandwidth_metrics_to_servers_table.php b/database/migrations/2022_10_16_134515_add_bandwidth_metrics_to_servers_table.php index fb25b0518d1..48acd0f9645 100644 --- a/database/migrations/2022_10_16_134515_add_bandwidth_metrics_to_servers_table.php +++ b/database/migrations/2022_10_16_134515_add_bandwidth_metrics_to_servers_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2022_10_20_215932_add_default_value_to_bandwidth_usage_column_in_servers_table.php b/database/migrations/2022_10_20_215932_add_default_value_to_bandwidth_usage_column_in_servers_table.php index a617bf35396..fcb1a080e37 100644 --- a/database/migrations/2022_10_20_215932_add_default_value_to_bandwidth_usage_column_in_servers_table.php +++ b/database/migrations/2022_10_20_215932_add_default_value_to_bandwidth_usage_column_in_servers_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2022_10_30_165927_rename_uuid_short_column_in_servers_table.php b/database/migrations/2022_10_30_165927_rename_uuid_short_column_in_servers_table.php index 3820bc82150..ce13d9eaa0e 100644 --- a/database/migrations/2022_10_30_165927_rename_uuid_short_column_in_servers_table.php +++ b/database/migrations/2022_10_30_165927_rename_uuid_short_column_in_servers_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2022_11_02_223634_refactor_activity_logs_table.php b/database/migrations/2022_11_02_223634_refactor_activity_logs_table.php index f52c34fa339..e411ef0f345 100644 --- a/database/migrations/2022_11_02_223634_refactor_activity_logs_table.php +++ b/database/migrations/2022_11_02_223634_refactor_activity_logs_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2022_11_13_154340_create_backups_table.php b/database/migrations/2022_11_13_154340_create_backups_table.php index be3764d9b38..00904a39a55 100644 --- a/database/migrations/2022_11_13_154340_create_backups_table.php +++ b/database/migrations/2022_11_13_154340_create_backups_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2022_11_13_203213_add_uuid_column_to_backups_table.php b/database/migrations/2022_11_13_203213_add_uuid_column_to_backups_table.php index b8c14614ebb..17337cb09db 100644 --- a/database/migrations/2022_11_13_203213_add_uuid_column_to_backups_table.php +++ b/database/migrations/2022_11_13_203213_add_uuid_column_to_backups_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2022_11_23_155133_add_storage_and_specification_columns_to_nodes_table.php b/database/migrations/2022_11_23_155133_add_storage_and_specification_columns_to_nodes_table.php index 6e0a698804b..7116a31f454 100644 --- a/database/migrations/2022_11_23_155133_add_storage_and_specification_columns_to_nodes_table.php +++ b/database/migrations/2022_11_23_155133_add_storage_and_specification_columns_to_nodes_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2022_11_23_180140_rename_columns_in_backups_table.php b/database/migrations/2022_11_23_180140_rename_columns_in_backups_table.php index 91461a1975f..4febcf2b100 100644 --- a/database/migrations/2022_11_23_180140_rename_columns_in_backups_table.php +++ b/database/migrations/2022_11_23_180140_rename_columns_in_backups_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2022_11_23_221039_add_soft_deletes_to_backups_table.php b/database/migrations/2022_11_23_221039_add_soft_deletes_to_backups_table.php index e15dd01e830..3f4bdbfc2e8 100644 --- a/database/migrations/2022_11_23_221039_add_soft_deletes_to_backups_table.php +++ b/database/migrations/2022_11_23_221039_add_soft_deletes_to_backups_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2022_11_24_205004_add_hostname_column_to_servers_table.php b/database/migrations/2022_11_24_205004_add_hostname_column_to_servers_table.php index c222f4fb294..8d715a1c2cd 100644 --- a/database/migrations/2022_11_24_205004_add_hostname_column_to_servers_table.php +++ b/database/migrations/2022_11_24_205004_add_hostname_column_to_servers_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2022_12_06_233100_move_network_column_in_nodes_table.php b/database/migrations/2022_12_06_233100_move_network_column_in_nodes_table.php index c718ccabe66..a451df835b8 100644 --- a/database/migrations/2022_12_06_233100_move_network_column_in_nodes_table.php +++ b/database/migrations/2022_12_06_233100_move_network_column_in_nodes_table.php @@ -5,8 +5,7 @@ use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2022_12_07_003704_create_locations_table.php b/database/migrations/2022_12_07_003704_create_locations_table.php index 9a24af00457..192be33fbb6 100644 --- a/database/migrations/2022_12_07_003704_create_locations_table.php +++ b/database/migrations/2022_12_07_003704_create_locations_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2022_12_07_004256_add_location_id_column_to_nodes_table.php b/database/migrations/2022_12_07_004256_add_location_id_column_to_nodes_table.php index 10ade0469d1..f721218f7ca 100644 --- a/database/migrations/2022_12_07_004256_add_location_id_column_to_nodes_table.php +++ b/database/migrations/2022_12_07_004256_add_location_id_column_to_nodes_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2022_12_07_014225_remove_nullable_from_foreign_keys.php b/database/migrations/2022_12_07_014225_remove_nullable_from_foreign_keys.php index dcb05f8198c..53d0e014318 100644 --- a/database/migrations/2022_12_07_014225_remove_nullable_from_foreign_keys.php +++ b/database/migrations/2022_12_07_014225_remove_nullable_from_foreign_keys.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2022_12_16_030651_rename_hostname_column_in_nodes_table.php b/database/migrations/2022_12_16_030651_rename_hostname_column_in_nodes_table.php index 3eb27bb601c..d59023c63d3 100644 --- a/database/migrations/2022_12_16_030651_rename_hostname_column_in_nodes_table.php +++ b/database/migrations/2022_12_16_030651_rename_hostname_column_in_nodes_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2022_12_22_174238_create_iso_library_table.php b/database/migrations/2022_12_22_174238_create_iso_library_table.php index 61b413d6c0f..54743a3a4c9 100644 --- a/database/migrations/2022_12_22_174238_create_iso_library_table.php +++ b/database/migrations/2022_12_22_174238_create_iso_library_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2022_12_22_182930_add_uuid_column_to_iso_library_table.php b/database/migrations/2022_12_22_182930_add_uuid_column_to_iso_library_table.php index a1afd000b33..045b3140622 100644 --- a/database/migrations/2022_12_22_182930_add_uuid_column_to_iso_library_table.php +++ b/database/migrations/2022_12_22_182930_add_uuid_column_to_iso_library_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2022_12_22_194029_add_iso_storage_column_to_nodes_table.php b/database/migrations/2022_12_22_194029_add_iso_storage_column_to_nodes_table.php index d1a57884b64..4f6c0bf512f 100644 --- a/database/migrations/2022_12_22_194029_add_iso_storage_column_to_nodes_table.php +++ b/database/migrations/2022_12_22_194029_add_iso_storage_column_to_nodes_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2022_12_25_005721_create_template_groups_table.php b/database/migrations/2022_12_25_005721_create_template_groups_table.php index 72d427d0a87..61c3b4d4187 100644 --- a/database/migrations/2022_12_25_005721_create_template_groups_table.php +++ b/database/migrations/2022_12_25_005721_create_template_groups_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2022_12_25_005722_fix_templates_table.php b/database/migrations/2022_12_25_005722_fix_templates_table.php index ddd153ffa81..f2a122dd8e8 100644 --- a/database/migrations/2022_12_25_005722_fix_templates_table.php +++ b/database/migrations/2022_12_25_005722_fix_templates_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2022_12_25_011046_add_node_id_column_to_template_groups_table.php b/database/migrations/2022_12_25_011046_add_node_id_column_to_template_groups_table.php index 8e9a1408b22..a62524eb6ef 100644 --- a/database/migrations/2022_12_25_011046_add_node_id_column_to_template_groups_table.php +++ b/database/migrations/2022_12_25_011046_add_node_id_column_to_template_groups_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2022_12_25_011208_fix_node_id_column_order_in_template_groups_table.php b/database/migrations/2022_12_25_011208_fix_node_id_column_order_in_template_groups_table.php index f8a32669c5b..8d57843f019 100644 --- a/database/migrations/2022_12_25_011208_fix_node_id_column_order_in_template_groups_table.php +++ b/database/migrations/2022_12_25_011208_fix_node_id_column_order_in_template_groups_table.php @@ -5,8 +5,7 @@ use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2022_12_25_011355_make_node_id_not_nullable_in_template_groups_table.php b/database/migrations/2022_12_25_011355_make_node_id_not_nullable_in_template_groups_table.php index b633b7335b1..62b52c83082 100644 --- a/database/migrations/2022_12_25_011355_make_node_id_not_nullable_in_template_groups_table.php +++ b/database/migrations/2022_12_25_011355_make_node_id_not_nullable_in_template_groups_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2022_12_25_011632_add_uuid_column_to_templates_table.php b/database/migrations/2022_12_25_011632_add_uuid_column_to_templates_table.php index 0b390b17816..5daf58807da 100644 --- a/database/migrations/2022_12_25_011632_add_uuid_column_to_templates_table.php +++ b/database/migrations/2022_12_25_011632_add_uuid_column_to_templates_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2023_01_15_153139_add_soft_deletes_column_to_servers_table.php b/database/migrations/2023_01_15_153139_add_soft_deletes_column_to_servers_table.php index c66405a62c2..4c31e5f0cde 100644 --- a/database/migrations/2023_01_15_153139_add_soft_deletes_column_to_servers_table.php +++ b/database/migrations/2023_01_15_153139_add_soft_deletes_column_to_servers_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2023_01_21_041004_add_soft_deletes_to_users_table.php b/database/migrations/2023_01_21_041004_add_soft_deletes_to_users_table.php index bcbe7e0274f..b6c0802d7c0 100644 --- a/database/migrations/2023_01_21_041004_add_soft_deletes_to_users_table.php +++ b/database/migrations/2023_01_21_041004_add_soft_deletes_to_users_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2023_01_21_043348_add_type_to_personal_access_tokens_table.php b/database/migrations/2023_01_21_043348_add_type_to_personal_access_tokens_table.php index 7c4812f8eef..0095766ac5c 100644 --- a/database/migrations/2023_01_21_043348_add_type_to_personal_access_tokens_table.php +++ b/database/migrations/2023_01_21_043348_add_type_to_personal_access_tokens_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2023_02_20_053349_create_ssh_keys_table.php b/database/migrations/2023_02_20_053349_create_ssh_keys_table.php index 2cefaec0e9b..976a6e96fd0 100644 --- a/database/migrations/2023_02_20_053349_create_ssh_keys_table.php +++ b/database/migrations/2023_02_20_053349_create_ssh_keys_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2023_03_06_212114_create_job_batches_table.php b/database/migrations/2023_03_06_212114_create_job_batches_table.php index 8d281de6379..cb609ec188e 100644 --- a/database/migrations/2023_03_06_212114_create_job_batches_table.php +++ b/database/migrations/2023_03_06_212114_create_job_batches_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2023_04_07_014605_remove_soft_deletes_from_users_table.php b/database/migrations/2023_04_07_014605_remove_soft_deletes_from_users_table.php index ccd046a5e6b..ed5ce326ae8 100644 --- a/database/migrations/2023_04_07_014605_remove_soft_deletes_from_users_table.php +++ b/database/migrations/2023_04_07_014605_remove_soft_deletes_from_users_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2023_04_07_015233_remove_soft_deletes_from_servers_table.php b/database/migrations/2023_04_07_015233_remove_soft_deletes_from_servers_table.php index f7c9ed1388a..5a2c21cc9f0 100644 --- a/database/migrations/2023_04_07_015233_remove_soft_deletes_from_servers_table.php +++ b/database/migrations/2023_04_07_015233_remove_soft_deletes_from_servers_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2023_04_28_000000_add_expires_at_to_personal_access_tokens_table.php b/database/migrations/2023_04_28_000000_add_expires_at_to_personal_access_tokens_table.php index 68b119fd5f2..365c1f41d7a 100644 --- a/database/migrations/2023_04_28_000000_add_expires_at_to_personal_access_tokens_table.php +++ b/database/migrations/2023_04_28_000000_add_expires_at_to_personal_access_tokens_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2023_04_28_000000_rename_password_resets_table.php b/database/migrations/2023_04_28_000000_rename_password_resets_table.php index c3f948980b7..f69ae13669f 100644 --- a/database/migrations/2023_04_28_000000_rename_password_resets_table.php +++ b/database/migrations/2023_04_28_000000_rename_password_resets_table.php @@ -3,8 +3,7 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2023_05_11_041215_add_token_id_column_to_nodes_table.php b/database/migrations/2023_05_11_041215_add_token_id_column_to_nodes_table.php index 131129d2d1c..b2b8793e33d 100644 --- a/database/migrations/2023_05_11_041215_add_token_id_column_to_nodes_table.php +++ b/database/migrations/2023_05_11_041215_add_token_id_column_to_nodes_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2023_05_11_042803_make_node_secret_column_a_text_type_in_nodes_table.php b/database/migrations/2023_05_11_042803_make_node_secret_column_a_text_type_in_nodes_table.php index 81e155f4e43..747a3bc0947 100644 --- a/database/migrations/2023_05_11_042803_make_node_secret_column_a_text_type_in_nodes_table.php +++ b/database/migrations/2023_05_11_042803_make_node_secret_column_a_text_type_in_nodes_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2023_05_11_042804_make_node_secret_encrypted_in_nodes_table.php b/database/migrations/2023_05_11_042804_make_node_secret_encrypted_in_nodes_table.php index aa31246ee66..d458c39759d 100644 --- a/database/migrations/2023_05_11_042804_make_node_secret_encrypted_in_nodes_table.php +++ b/database/migrations/2023_05_11_042804_make_node_secret_encrypted_in_nodes_table.php @@ -14,7 +14,6 @@ public function up(): void Schema::table('nodes', function (Blueprint $table) { $nodes = DB::table('nodes')->get()->toArray(); - foreach ($nodes as $node) { DB::table('nodes') ->where('id', $node->id) @@ -31,7 +30,6 @@ public function down(): void Schema::table('nodes', function (Blueprint $table) { $nodes = DB::table('nodes')->get()->toArray(); - foreach ($nodes as $node) { DB::table('nodes') ->where('id', $node->id) diff --git a/database/migrations/2023_05_11_043101_make_coterm_token_id_unique_in_nodes_table.php b/database/migrations/2023_05_11_043101_make_coterm_token_id_unique_in_nodes_table.php index 1e7fe60cbfb..ff41f8d8d3d 100644 --- a/database/migrations/2023_05_11_043101_make_coterm_token_id_unique_in_nodes_table.php +++ b/database/migrations/2023_05_11_043101_make_coterm_token_id_unique_in_nodes_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2023_05_20_200644_add_coterm_enabled_column_to_nodes_table.php b/database/migrations/2023_05_20_200644_add_coterm_enabled_column_to_nodes_table.php index f74dae2230f..1e529c41034 100644 --- a/database/migrations/2023_05_20_200644_add_coterm_enabled_column_to_nodes_table.php +++ b/database/migrations/2023_05_20_200644_add_coterm_enabled_column_to_nodes_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2023_05_21_015205_move_port_column_to_behind_fqdn_in_nodes_table.php b/database/migrations/2023_05_21_015205_move_port_column_to_behind_fqdn_in_nodes_table.php index 1d7df8926c7..a40226bbeee 100644 --- a/database/migrations/2023_05_21_015205_move_port_column_to_behind_fqdn_in_nodes_table.php +++ b/database/migrations/2023_05_21_015205_move_port_column_to_behind_fqdn_in_nodes_table.php @@ -5,8 +5,7 @@ use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2023_05_28_025503_create_address_pools_table.php b/database/migrations/2023_05_28_025503_create_address_pools_table.php index 1cc8e62695d..d15e2141f2d 100644 --- a/database/migrations/2023_05_28_025503_create_address_pools_table.php +++ b/database/migrations/2023_05_28_025503_create_address_pools_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2023_05_28_031255_create_address_pool_to_node_table.php b/database/migrations/2023_05_28_031255_create_address_pool_to_node_table.php index 44f1f72f245..5194b45956c 100644 --- a/database/migrations/2023_05_28_031255_create_address_pool_to_node_table.php +++ b/database/migrations/2023_05_28_031255_create_address_pool_to_node_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2023_05_28_032248_add_uuid_column_to_users_table.php b/database/migrations/2023_05_28_032248_add_uuid_column_to_users_table.php index 24ec3d60df3..2b4a1361b24 100644 --- a/database/migrations/2023_05_28_032248_add_uuid_column_to_users_table.php +++ b/database/migrations/2023_05_28_032248_add_uuid_column_to_users_table.php @@ -5,8 +5,7 @@ use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2023_05_28_133425_make_uuid_unique_and_nonnullable_in_users_table.php b/database/migrations/2023_05_28_133425_make_uuid_unique_and_nonnullable_in_users_table.php index d5684e99474..2d70e4ae068 100644 --- a/database/migrations/2023_05_28_133425_make_uuid_unique_and_nonnullable_in_users_table.php +++ b/database/migrations/2023_05_28_133425_make_uuid_unique_and_nonnullable_in_users_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2023_05_28_151803_drop_sso_tokens_table.php b/database/migrations/2023_05_28_151803_drop_sso_tokens_table.php index c048201ee3b..fc509e9a56e 100644 --- a/database/migrations/2023_05_28_151803_drop_sso_tokens_table.php +++ b/database/migrations/2023_05_28_151803_drop_sso_tokens_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2023_06_04_153504_create_address_table_that_uses_ip_pools.php b/database/migrations/2023_06_04_153504_create_address_table_that_uses_ip_pools.php index 40ae201d0fe..1e246d07827 100644 --- a/database/migrations/2023_06_04_153504_create_address_table_that_uses_ip_pools.php +++ b/database/migrations/2023_06_04_153504_create_address_table_that_uses_ip_pools.php @@ -2,8 +2,8 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; -use Illuminate\Support\Collection; use Illuminate\Support\Arr; +use Illuminate\Support\Collection; use Illuminate\Support\Facades\Schema; return new class extends Migration { @@ -33,7 +33,7 @@ public function up(): void /** * The key is the node id and the value is the address pool id - * @var array $pools + * @var array $pools */ $pools = []; @@ -53,14 +53,14 @@ public function up(): void $payload = []; foreach ($addresses as $address) { - if (!array_key_exists($address->node_id, $pools)) { + if (! array_key_exists($address->node_id, $pools)) { $poolId = DB::table('address_pools')->insertGetId([ - 'name' => "Node {$address->fqdn}" + 'name' => "Node {$address->fqdn}", ]); DB::table('address_pool_to_node')->insert([ 'address_pool_id' => $poolId, - 'node_id' => $address->node_id + 'node_id' => $address->node_id, ]); $pools[$address->node_id] = $poolId; @@ -134,9 +134,7 @@ public function down(): void $addresses = DB::table('temp_ip_addresses')->where('address_pool_id', '=', $pool->id)->get(); foreach ($addresses as $address) { - foreach ($linkedNodeIds as $linkedNodeId) { - $payload[] = [ 'node_id' => $linkedNodeId, 'server_id' => $address->server_id, @@ -151,7 +149,6 @@ public function down(): void ]; } } - } DB::table('ip_addresses')->insert($payload); diff --git a/database/migrations/2023_06_19_234120_make_file_name_non_nullable_in_isos_table.php b/database/migrations/2023_06_19_234120_make_file_name_non_nullable_in_isos_table.php index 89ad29f98ad..5e5292f73d9 100644 --- a/database/migrations/2023_06_19_234120_make_file_name_non_nullable_in_isos_table.php +++ b/database/migrations/2023_06_19_234120_make_file_name_non_nullable_in_isos_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2023_09_03_174812_move_types_column_in_ip_addresses_table.php b/database/migrations/2023_09_03_174812_move_types_column_in_ip_addresses_table.php index db9139ba82d..3e60bb6542c 100644 --- a/database/migrations/2023_09_03_174812_move_types_column_in_ip_addresses_table.php +++ b/database/migrations/2023_09_03_174812_move_types_column_in_ip_addresses_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2023_11_11_175741_create_coterms_table.php b/database/migrations/2023_11_11_175741_create_coterms_table.php index 8a1bafef189..6f7a7fa5b44 100644 --- a/database/migrations/2023_11_11_175741_create_coterms_table.php +++ b/database/migrations/2023_11_11_175741_create_coterms_table.php @@ -1,8 +1,8 @@ integer('snapshot_size_limit')->after('snapshot_count_limit'); $table->integer('backup_size_limit')->after('backup_count_limit'); @@ -84,4 +83,4 @@ public function down(): void 'ALTER TABLE servers CHANGE COLUMN bandwidth_limit bandwidth_limit INT UNSIGNED NULL;', ); } -}; \ No newline at end of file +}; diff --git a/phpunit.xml b/phpunit.xml index 28ae990a485..4daaa6a9aad 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -12,7 +12,7 @@ - + diff --git a/public/index.php b/public/index.php index 5e81d352eff..947d98963f0 100644 --- a/public/index.php +++ b/public/index.php @@ -1,55 +1,17 @@ make(Kernel::class); - -$response = $kernel->handle( - $request = Request::capture() -)->send(); - -$kernel->terminate($request, $response); +// Bootstrap Laravel and handle the request... +(require_once __DIR__.'/../bootstrap/app.php') + ->handleRequest(Request::capture()); diff --git a/routes/api-admin.php b/routes/api-admin.php index c55c733ad17..504c98d631a 100644 --- a/routes/api-admin.php +++ b/routes/api-admin.php @@ -146,33 +146,32 @@ Route::get('/', [Admin\ServerController::class, 'index']); Route::post('/', [Admin\ServerController::class, 'store']); - Route::group(['prefix' => '/{server}', 'middleware' => ValidateServerStatusMiddleware::class], - function () { - Route::get('/', [Admin\ServerController::class, 'show']) - ->withoutMiddleware( - ValidateServerStatusMiddleware::class, - ); - Route::patch('/', [Admin\ServerController::class, 'update']) - ->withoutMiddleware( - ValidateServerStatusMiddleware::class, - ); - Route::delete('/', [Admin\ServerController::class, 'destroy']); + Route::prefix('/{server}')->middleware(ValidateServerStatusMiddleware::class)->group(function () { + Route::get('/', [Admin\ServerController::class, 'show']) + ->withoutMiddleware( + ValidateServerStatusMiddleware::class, + ); + Route::patch('/', [Admin\ServerController::class, 'update']) + ->withoutMiddleware( + ValidateServerStatusMiddleware::class, + ); + Route::delete('/', [Admin\ServerController::class, 'destroy']); - Route::prefix('/settings')->group(function () { - Route::patch( - '/build', - [Admin\ServerController::class, 'updateBuild'], - ); + Route::prefix('/settings')->group(function () { + Route::patch( + '/build', + [Admin\ServerController::class, 'updateBuild'], + ); - Route::post( - '/suspend', [Admin\ServerController::class, 'suspend'], - ); - Route::post( - '/unsuspend', - [Admin\ServerController::class, 'unsuspend'], - ); - }); + Route::post( + '/suspend', [Admin\ServerController::class, 'suspend'], + ); + Route::post( + '/unsuspend', + [Admin\ServerController::class, 'unsuspend'], + ); }); + }); }); /* diff --git a/routes/api-application.php b/routes/api-application.php index 4a60d9fbde4..8c08228b90f 100644 --- a/routes/api-application.php +++ b/routes/api-application.php @@ -146,33 +146,32 @@ Route::get('/', [Admin\ServerController::class, 'index']); Route::post('/', [Admin\ServerController::class, 'store']); - Route::group(['prefix' => '/{server}', 'middleware' => ValidateServerStatusMiddleware::class], - function () { - Route::get('/', [Admin\ServerController::class, 'show']) - ->withoutMiddleware( - ValidateServerStatusMiddleware::class, - ); - Route::patch('/', [Admin\ServerController::class, 'update']) - ->withoutMiddleware( - ValidateServerStatusMiddleware::class, - ); - Route::delete('/', [Admin\ServerController::class, 'destroy']); + Route::prefix('/{server}')->middleware(ValidateServerStatusMiddleware::class)->group(function () { + Route::get('/', [Admin\ServerController::class, 'show']) + ->withoutMiddleware( + ValidateServerStatusMiddleware::class, + ); + Route::patch('/', [Admin\ServerController::class, 'update']) + ->withoutMiddleware( + ValidateServerStatusMiddleware::class, + ); + Route::delete('/', [Admin\ServerController::class, 'destroy']); - Route::prefix('/settings')->group(function () { - Route::patch( - '/build', - [Admin\ServerController::class, 'updateBuild'], - ); + Route::prefix('/settings')->group(function () { + Route::patch( + '/build', + [Admin\ServerController::class, 'updateBuild'], + ); - Route::post( - '/suspend', [Admin\ServerController::class, 'suspend'], - ); - Route::post( - '/unsuspend', - [Admin\ServerController::class, 'unsuspend'], - ); - }); + Route::post( + '/suspend', [Admin\ServerController::class, 'suspend'], + ); + Route::post( + '/unsuspend', + [Admin\ServerController::class, 'unsuspend'], + ); }); + }); }); /* diff --git a/routes/api-coterm.php b/routes/api-coterm.php index 27fbe9665c3..f5cd0ab4bde 100644 --- a/routes/api-coterm.php +++ b/routes/api-coterm.php @@ -8,4 +8,4 @@ '/create-console-session', [Coterm\SessionController::class, 'store'], ); -}); \ No newline at end of file +}); diff --git a/routes/console.php b/routes/console.php new file mode 100644 index 00000000000..d45d76e5ae3 --- /dev/null +++ b/routes/console.php @@ -0,0 +1,32 @@ +comment(Inspiring::quote()); +})->purpose('Display an inspiring quote')->hourly(); + +Schedule::command('queue:prune-batches')->daily(); + +if (config('backups.prune_age')) { + // Every 30 minutes, run the backup pruning command so that any abandoned backups can be deleted. + Schedule::command(PruneOrphanedBackupsCommand::class)->everyThirtyMinutes(); +} + +if (config('activity.prune_days')) { + Schedule::command(PruneCommand::class, ['--model' => [ActivityLog::class]])->daily(); +} + +Schedule::command(ResetUsagesCommand::class)->daily(); +Schedule::command(PruneUsersCommand::class)->daily(); +Schedule::command(UpdateUsagesCommand::class)->everyFiveMinutes(); +Schedule::command(UpdateRateLimitsCommand::class)->everyTenMinutes(); diff --git a/tests/CreatesApplication.php b/tests/CreatesApplication.php deleted file mode 100644 index 9b7cfa6a511..00000000000 --- a/tests/CreatesApplication.php +++ /dev/null @@ -1,21 +0,0 @@ -make(Kernel::class)->bootstrap(); - - return $app; - } -} diff --git a/tests/Feature/Controllers/Admin/LocationControllerTest.php b/tests/Feature/Controllers/Admin/LocationControllerTest.php index c6291f2c3a0..d33fc13feb3 100644 --- a/tests/Feature/Controllers/Admin/LocationControllerTest.php +++ b/tests/Feature/Controllers/Admin/LocationControllerTest.php @@ -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..9d8b9d5a7b2 100644 --- a/tests/Feature/Controllers/Admin/Nodes/AddressControllerTest.php +++ b/tests/Feature/Controllers/Admin/Nodes/AddressControllerTest.php @@ -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..acd0367ee8a 100644 --- a/tests/Feature/Controllers/Admin/Nodes/IsoControllerTest.php +++ b/tests/Feature/Controllers/Admin/Nodes/IsoControllerTest.php @@ -113,10 +113,10 @@ ]); $response = $this->actingAs($this->user)->getJson( - '/tools/query-remote-file?link=' . urlencode( + '/tools/query-remote-file?link='.urlencode( 'https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso', ), ); $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..3b5f8e67ea9 100644 --- a/tests/Feature/Controllers/Admin/Nodes/NodeControllerTest.php +++ b/tests/Feature/Controllers/Admin/Nodes/NodeControllerTest.php @@ -1,6 +1,5 @@ Http::response(['data' => 'upid'], 200), @@ -27,14 +26,14 @@ function testCreateBackup( $response = $this->actingAs($user)->postJson( "/api/client/servers/{$server->uuid}/backups", [ - 'name' => 'Test Backup', - 'mode' => 'snapshot', - 'compression_type' => 'none', - 'is_locked' => false, - ], + 'name' => 'Test Backup', + 'mode' => 'snapshot', + 'compression_type' => 'none', + 'is_locked' => false, + ], ); - if ($useSecondUser && !$secondUserIsAdmin) { + if ($useSecondUser && ! $secondUserIsAdmin) { $response->assertNotFound(); return; @@ -51,8 +50,7 @@ function testCreateBackup( function testRestoreBackups( bool $useSecondUser = false, bool $secondUserIsAdmin = false, -): Closure -{ +): Closure { return function () use ($useSecondUser, $secondUserIsAdmin) { Http::fake([ '*/status/current' => Http::response( @@ -81,7 +79,7 @@ function testRestoreBackups( "/api/client/servers/{$server->uuid}/backups/{$backup->uuid}/restore", ); - if ($useSecondUser && !$secondUserIsAdmin) { + if ($useSecondUser && ! $secondUserIsAdmin) { $response->assertNotFound(); return; @@ -96,8 +94,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), @@ -111,19 +108,17 @@ function testDeleteBackups( ]); } - $backup = Backup::factory()->create([ 'is_successful' => true, 'is_locked' => false, 'server_id' => $server->id, ]); - $response = $this->actingAs($user)->deleteJson( "/api/client/servers/{$server->uuid}/backups/{$backup->uuid}", ); - if ($useSecondUser && !$secondUserIsAdmin) { + if ($useSecondUser && ! $secondUserIsAdmin) { $response->assertNotFound(); return; @@ -193,4 +188,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/ServerControllerTest.php b/tests/Feature/Controllers/Client/Servers/ServerControllerTest.php index 7501877b51e..307045a48cc 100644 --- a/tests/Feature/Controllers/Client/Servers/ServerControllerTest.php +++ b/tests/Feature/Controllers/Client/Servers/ServerControllerTest.php @@ -26,8 +26,8 @@ $response = $this->actingAs($user)->postJson( "/api/client/servers/{$server->uuid}/create-console-session", [ - 'type' => 'novnc', - ], + 'type' => 'novnc', + ], ); $response->assertOk(); diff --git a/tests/Feature/Controllers/Client/Servers/SettingsControllerTest.php b/tests/Feature/Controllers/Client/Servers/SettingsControllerTest.php index 6de633b5f0f..7b364170121 100644 --- a/tests/Feature/Controllers/Client/Servers/SettingsControllerTest.php +++ b/tests/Feature/Controllers/Client/Servers/SettingsControllerTest.php @@ -12,9 +12,9 @@ $response = $this->actingAs($user)->postJson( "/api/client/servers/{$server->uuid}/settings/rename", [ - 'name' => 'advinservers is king', - 'hostname' => 'advinservers.com', - ], + 'name' => 'advinservers is king', + 'hostname' => 'advinservers.com', + ], ); $response->assertOk() @@ -36,11 +36,11 @@ $response = $this->actingAs($user)->putJson( "/api/client/servers/{$server->uuid}/settings/network", [ - 'nameservers' => [ - '1.1.1.1', - '1.0.0.1', + 'nameservers' => [ + '1.1.1.1', + '1.0.0.1', + ], ], - ], ); $response->assertOk(); @@ -79,9 +79,9 @@ $response = $this->actingAs($user)->putJson( "/api/client/servers/{$server->uuid}/settings/auth", [ - 'type' => 'password', - 'password' => 'Advinservers is king!123', - ], + 'type' => 'password', + 'password' => 'Advinservers is king!123', + ], ); $response->assertNoContent(); diff --git a/tests/Pest.php b/tests/Pest.php index afdb8b85f06..2e533648c72 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -22,7 +22,7 @@ uses( Tests\TestCase::class, DatabaseTransactions::class, -// Illuminate\Foundation\Testing\RefreshDatabase::class, + // Illuminate\Foundation\Testing\RefreshDatabase::class, )->beforeEach(function () { Http::preventStrayRequests(); Queue::fake(); diff --git a/tests/TestCase.php b/tests/TestCase.php index 2932d4a69d6..fe1ffc2ff1a 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -6,5 +6,5 @@ abstract class TestCase extends BaseTestCase { - use CreatesApplication; + // }