refactor: enhance ConnectionStatus handling and remove redundant logo field

- Added `ConnectionStatusData` DTO and `ConnectionStatusService` for managing connection statuses with mapped enums.
- Updated `ConnectedAppFactory` and Livewire `StoreConnectedAppForm` to integrate `ConnectionStatusData` and remove `logoUrl` field.
- Adjusted `ConnectedApp` model to rename columns for consistency.
- Implemented error handling in `ConnectedAppService::create()` for improved resilience.
- Updated Blade templates and composer dependencies for compatibility.
This commit is contained in:
= 2026-05-14 06:22:40 +00:00
parent df3a37d6cb
commit f90655bc43
9 changed files with 154 additions and 170 deletions

View File

@ -4,11 +4,11 @@
namespace App\Data\ConnectedApp; namespace App\Data\ConnectedApp;
use Spatie\LaravelData\Attributes\MapInputName; use Spatie\LaravelData\Attributes\MapOutputName;
use Spatie\LaravelData\Data; use Spatie\LaravelData\Data;
use Spatie\LaravelData\Mappers\SnakeCaseMapper; use Spatie\LaravelData\Mappers\SnakeCaseMapper;
#[MapInputName(SnakeCaseMapper::class)] #[MapOutputName(SnakeCaseMapper::class)]
class ConnectAppRequest extends Data class ConnectAppRequest extends Data
{ {
public function __construct( public function __construct(
@ -16,8 +16,7 @@ public function __construct(
public int $connectionProviderId, public int $connectionProviderId,
public int $connectionProtocolId, public int $connectionProtocolId,
public ?string $connectionService = null, public ?string $connectionService = null,
public ?string $logoUrl = null,
public ?string $slug = null, public ?string $slug = null,
public ?int $statusId = null, public ?int $connectionStatusId = null,
) {} ) {}
} }

View File

@ -0,0 +1,23 @@
<?php
namespace App\Data\ConnectedApp;
use App\Enums\ConnectionStatusEnum;
use Spatie\LaravelData\Attributes\MapInputName;
use Spatie\LaravelData\Attributes\WithCast;
use Spatie\LaravelData\Casts\EnumCast;
use Spatie\LaravelData\Data;
use Spatie\LaravelData\Mappers\SnakeCaseMapper;
#[MapInputName(SnakeCaseMapper::class)]
class ConnectionStatusData extends Data
{
public function __construct(
public int $id,
#[WithCast(EnumCast::class)]
public ConnectionStatusEnum $name,
)
{
}
}

View File

@ -16,7 +16,6 @@ public function createDataFromDto(ConnectAppRequest $data): array
'name' => $data->name, 'name' => $data->name,
'connection_provider_id' => $data->connectionProviderId, 'connection_provider_id' => $data->connectionProviderId,
'connection_protocol_id' => $data->connectionProtocolId, 'connection_protocol_id' => $data->connectionProtocolId,
'logo_url' => $data->logoUrl,
'slug' => $data->slug, 'slug' => $data->slug,
'connection_status_id' => $data->statusId, 'connection_status_id' => $data->statusId,
]; ];

View File

@ -23,9 +23,6 @@ class StoreConnectedAppFrom extends Form
#[Validate('required|numeric|min:1|exists:connection_statuses,id')] #[Validate('required|numeric|min:1|exists:connection_statuses,id')]
public int $statusId = 0; public int $statusId = 0;
#[Validate('nullable|string|max:255|min:3')]
public ?string $logoUrl = null;
public function save(): void public function save(): void
{ {
$this->validate(); $this->validate();
@ -34,11 +31,9 @@ public function save(): void
name: $this->name, name: $this->name,
connectionProviderId: $this->providerId, connectionProviderId: $this->providerId,
connectionProtocolId: $this->protocolId, connectionProtocolId: $this->protocolId,
logoUrl: $this->logoUrl,
slug: str($this->name)->slug()->toString(), slug: str($this->name)->slug()->toString(),
statusId: $this->statusId, connectionStatusId: $this->statusId,
); );
app(ConnectedAppService::class)->create($serviceData); app(ConnectedAppService::class)->create($serviceData);
$this->reset(); $this->reset();
} }

View File

@ -11,9 +11,9 @@
#[Fillable([ #[Fillable([
'name', 'name',
'slug', 'slug',
'service_protocol_id', 'connection_protocol_id',
'service_provider_id', 'connection_provider_id',
'service_status_id', 'connection_status_id',
])] ])]
class ConnectedApp extends Model class ConnectedApp extends Model
{ {

View File

@ -5,18 +5,21 @@
namespace App\Services; namespace App\Services;
use App\Data\ConnectedApp\ConnectAppRequest; use App\Data\ConnectedApp\ConnectAppRequest;
use App\Factories\ConnectedAppFactory;
use App\Models\ConnectedApp; use App\Models\ConnectedApp;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Throwable;
final class ConnectedAppService final class ConnectedAppService
{ {
/**
* Create a new connected app.
* @throws Throwable
*/
public function create(ConnectAppRequest $data): void public function create(ConnectAppRequest $data): void
{ {
$data = app(ConnectedAppFactory::class)->createDataFromDto($data);
DB::transaction( DB::transaction(
fn () => ConnectedApp::create( fn () => ConnectedApp::query()->create(
$data $data->toArray()
) )
); );
} }

View File

@ -0,0 +1,19 @@
<?php
namespace App\Services;
use App\Data\ConnectedApp\ConnectionStatusData;
use App\Models\ConnectionStatus;
use Spatie\LaravelData\DataCollection;
class ConnectionStatusService
{
/**
* @return DataCollection<int, ConnectionStatusData>
*/
public function getAll(): DataCollection
{
$statuses = ConnectionStatus::query()->get();
return ConnectionStatusData::collect($statuses, DataCollection::class);
}
}

218
composer.lock generated
View File

@ -1494,16 +1494,16 @@
}, },
{ {
"name": "laravel/framework", "name": "laravel/framework",
"version": "v13.8.0", "version": "v13.9.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/laravel/framework.git", "url": "https://github.com/laravel/framework.git",
"reference": "e7db333a025a1e93ebca7744953069d7719f4bcf" "reference": "a0c6ad03b380287015287d8d5a0fa2459e2332fd"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/laravel/framework/zipball/e7db333a025a1e93ebca7744953069d7719f4bcf", "url": "https://api.github.com/repos/laravel/framework/zipball/a0c6ad03b380287015287d8d5a0fa2459e2332fd",
"reference": "e7db333a025a1e93ebca7744953069d7719f4bcf", "reference": "a0c6ad03b380287015287d8d5a0fa2459e2332fd",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1607,7 +1607,7 @@
"aws/aws-sdk-php": "^3.322.9", "aws/aws-sdk-php": "^3.322.9",
"ext-gmp": "*", "ext-gmp": "*",
"fakerphp/faker": "^1.24", "fakerphp/faker": "^1.24",
"guzzlehttp/psr7": "^2.4", "guzzlehttp/psr7": "^2.9",
"laravel/pint": "^1.18", "laravel/pint": "^1.18",
"league/flysystem-aws-s3-v3": "^3.25.1", "league/flysystem-aws-s3-v3": "^3.25.1",
"league/flysystem-ftp": "^3.25.1", "league/flysystem-ftp": "^3.25.1",
@ -1714,7 +1714,7 @@
"issues": "https://github.com/laravel/framework/issues", "issues": "https://github.com/laravel/framework/issues",
"source": "https://github.com/laravel/framework" "source": "https://github.com/laravel/framework"
}, },
"time": "2026-05-05T21:01:14+00:00" "time": "2026-05-13T15:38:40+00:00"
}, },
{ {
"name": "laravel/passkeys", "name": "laravel/passkeys",
@ -3011,16 +3011,16 @@
}, },
{ {
"name": "nette/utils", "name": "nette/utils",
"version": "v4.1.3", "version": "v4.1.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/nette/utils.git", "url": "https://github.com/nette/utils.git",
"reference": "bb3ea637e3d131d72acc033cfc2746ee893349fe" "reference": "7da6c396d7ebe142bc857c20479d5e70a5e1aac7"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/nette/utils/zipball/bb3ea637e3d131d72acc033cfc2746ee893349fe", "url": "https://api.github.com/repos/nette/utils/zipball/7da6c396d7ebe142bc857c20479d5e70a5e1aac7",
"reference": "bb3ea637e3d131d72acc033cfc2746ee893349fe", "reference": "7da6c396d7ebe142bc857c20479d5e70a5e1aac7",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3096,9 +3096,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/nette/utils/issues", "issues": "https://github.com/nette/utils/issues",
"source": "https://github.com/nette/utils/tree/v4.1.3" "source": "https://github.com/nette/utils/tree/v4.1.4"
}, },
"time": "2026-02-13T03:05:33+00:00" "time": "2026-05-11T20:49:54+00:00"
}, },
{ {
"name": "nikic/php-parser", "name": "nikic/php-parser",
@ -3314,78 +3314,6 @@
}, },
"time": "2025-09-24T15:06:41+00:00" "time": "2025-09-24T15:06:41+00:00"
}, },
{
"name": "phpdocumentor/reflection",
"version": "6.6.0",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/Reflection.git",
"reference": "c8d36446027506a005103d57265ba5ea56beabfc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/Reflection/zipball/c8d36446027506a005103d57265ba5ea56beabfc",
"reference": "c8d36446027506a005103d57265ba5ea56beabfc",
"shasum": ""
},
"require": {
"composer-runtime-api": "^2",
"nikic/php-parser": "~4.18 || ^5.0",
"php": "8.1.*|8.2.*|8.3.*|8.4.*|8.5.*",
"phpdocumentor/reflection-common": "^2.1",
"phpdocumentor/reflection-docblock": "^5",
"phpdocumentor/type-resolver": "^1.4",
"symfony/polyfill-php80": "^1.28",
"webmozart/assert": "^1.7"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
"doctrine/coding-standard": "^13.0",
"eliashaeussler/phpunit-attributes": "^1.8",
"mikey179/vfsstream": "~1.2",
"mockery/mockery": "~1.6.0",
"phpspec/prophecy-phpunit": "^2.4",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan": "^1.8",
"phpstan/phpstan-webmozart-assert": "^1.2",
"phpunit/phpunit": "^10.5.53",
"psalm/phar": "^6.0",
"rector/rector": "^1.0.0",
"squizlabs/php_codesniffer": "^3.8"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-5.x": "5.3.x-dev",
"dev-6.x": "6.0.x-dev"
}
},
"autoload": {
"files": [
"src/php-parser/Modifiers.php"
],
"psr-4": {
"phpDocumentor\\": "src/phpDocumentor"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "Reflection library to do Static Analysis for PHP Projects",
"homepage": "http://www.phpdoc.org",
"keywords": [
"phpDocumentor",
"phpdoc",
"reflection",
"static analysis"
],
"support": {
"issues": "https://github.com/phpDocumentor/Reflection/issues",
"source": "https://github.com/phpDocumentor/Reflection/tree/6.6.0"
},
"time": "2026-04-12T18:07:10+00:00"
},
{ {
"name": "phpdocumentor/reflection-common", "name": "phpdocumentor/reflection-common",
"version": "2.2.0", "version": "2.2.0",
@ -4426,22 +4354,24 @@
}, },
{ {
"name": "spatie/laravel-data", "name": "spatie/laravel-data",
"version": "4.22.1", "version": "4.23.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/spatie/laravel-data.git", "url": "https://github.com/spatie/laravel-data.git",
"reference": "ec254c0ebc3f3b37515cd7449e2dbb10588e606b" "reference": "230543769c996e407fec2873930626aed7dd0d3b"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/spatie/laravel-data/zipball/ec254c0ebc3f3b37515cd7449e2dbb10588e606b", "url": "https://api.github.com/repos/spatie/laravel-data/zipball/230543769c996e407fec2873930626aed7dd0d3b",
"reference": "ec254c0ebc3f3b37515cd7449e2dbb10588e606b", "reference": "230543769c996e407fec2873930626aed7dd0d3b",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"illuminate/contracts": "^10.0|^11.0|^12.0|^13.0", "illuminate/contracts": "^10.0|^11.0|^12.0|^13.0",
"php": "^8.1", "php": "^8.1",
"phpdocumentor/reflection": "^6.0", "phpdocumentor/reflection-common": "^2.2",
"phpdocumentor/reflection-docblock": "^5.3 || ^6.0",
"phpdocumentor/type-resolver": "^1.7 || ^2.0",
"spatie/laravel-package-tools": "^1.9.0", "spatie/laravel-package-tools": "^1.9.0",
"spatie/php-structure-discoverer": "^2.0" "spatie/php-structure-discoverer": "^2.0"
}, },
@ -4496,7 +4426,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/spatie/laravel-data/issues", "issues": "https://github.com/spatie/laravel-data/issues",
"source": "https://github.com/spatie/laravel-data/tree/4.22.1" "source": "https://github.com/spatie/laravel-data/tree/4.23.0"
}, },
"funding": [ "funding": [
{ {
@ -4504,7 +4434,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2026-04-27T07:30:53+00:00" "time": "2026-05-08T14:41:13+00:00"
}, },
{ {
"name": "spatie/laravel-package-tools", "name": "spatie/laravel-package-tools",
@ -4994,16 +4924,16 @@
}, },
{ {
"name": "symfony/console", "name": "symfony/console",
"version": "v8.0.9", "version": "v8.0.11",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/console.git", "url": "https://github.com/symfony/console.git",
"reference": "7113778e2e91f4709cb3194a75dfa9c0d028d94d" "reference": "3156577f46a38aa1b9323aad223de7a9cd426782"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/7113778e2e91f4709cb3194a75dfa9c0d028d94d", "url": "https://api.github.com/repos/symfony/console/zipball/3156577f46a38aa1b9323aad223de7a9cd426782",
"reference": "7113778e2e91f4709cb3194a75dfa9c0d028d94d", "reference": "3156577f46a38aa1b9323aad223de7a9cd426782",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -5060,7 +4990,7 @@
"terminal" "terminal"
], ],
"support": { "support": {
"source": "https://github.com/symfony/console/tree/v8.0.9" "source": "https://github.com/symfony/console/tree/v8.0.11"
}, },
"funding": [ "funding": [
{ {
@ -5080,7 +5010,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2026-04-29T15:02:55+00:00" "time": "2026-05-13T12:07:53+00:00"
}, },
{ {
"name": "symfony/css-selector", "name": "symfony/css-selector",
@ -5618,16 +5548,16 @@
}, },
{ {
"name": "symfony/http-kernel", "name": "symfony/http-kernel",
"version": "v8.0.10", "version": "v8.0.11",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/http-kernel.git", "url": "https://github.com/symfony/http-kernel.git",
"reference": "fb3f65b3d4ca2dad31c80d323819a762ca31d6ac" "reference": "20d3680373f4b791903c09e74b45402b4aeda71c"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/fb3f65b3d4ca2dad31c80d323819a762ca31d6ac", "url": "https://api.github.com/repos/symfony/http-kernel/zipball/20d3680373f4b791903c09e74b45402b4aeda71c",
"reference": "fb3f65b3d4ca2dad31c80d323819a762ca31d6ac", "reference": "20d3680373f4b791903c09e74b45402b4aeda71c",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -5698,7 +5628,7 @@
"description": "Provides a structured process for converting a Request into a Response", "description": "Provides a structured process for converting a Request into a Response",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/http-kernel/tree/v8.0.10" "source": "https://github.com/symfony/http-kernel/tree/v8.0.11"
}, },
"funding": [ "funding": [
{ {
@ -5718,7 +5648,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2026-05-06T12:27:31+00:00" "time": "2026-05-13T18:07:14+00:00"
}, },
{ {
"name": "symfony/mailer", "name": "symfony/mailer",
@ -6797,16 +6727,16 @@
}, },
{ {
"name": "symfony/process", "name": "symfony/process",
"version": "v8.0.8", "version": "v8.0.11",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/process.git", "url": "https://github.com/symfony/process.git",
"reference": "cb8939aff03470d1a9d1d1b66d08c6fa71b3bbdc" "reference": "26d89e459f037d2873300605d0a07e7a8ef84db0"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/cb8939aff03470d1a9d1d1b66d08c6fa71b3bbdc", "url": "https://api.github.com/repos/symfony/process/zipball/26d89e459f037d2873300605d0a07e7a8ef84db0",
"reference": "cb8939aff03470d1a9d1d1b66d08c6fa71b3bbdc", "reference": "26d89e459f037d2873300605d0a07e7a8ef84db0",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -6838,7 +6768,7 @@
"description": "Executes commands in sub-processes", "description": "Executes commands in sub-processes",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/process/tree/v8.0.8" "source": "https://github.com/symfony/process/tree/v8.0.11"
}, },
"funding": [ "funding": [
{ {
@ -6858,7 +6788,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2026-03-30T15:14:47+00:00" "time": "2026-05-11T16:56:32+00:00"
}, },
{ {
"name": "symfony/property-access", "name": "symfony/property-access",
@ -7113,16 +7043,16 @@
}, },
{ {
"name": "symfony/serializer", "name": "symfony/serializer",
"version": "v7.4.8", "version": "v7.4.10",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/serializer.git", "url": "https://github.com/symfony/serializer.git",
"reference": "006fd51717addf2df2bd1a64dafef6b7fab6b455" "reference": "268c5aa6c4bd675eddd89348e7ecac292a843ddd"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/serializer/zipball/006fd51717addf2df2bd1a64dafef6b7fab6b455", "url": "https://api.github.com/repos/symfony/serializer/zipball/268c5aa6c4bd675eddd89348e7ecac292a843ddd",
"reference": "006fd51717addf2df2bd1a64dafef6b7fab6b455", "reference": "268c5aa6c4bd675eddd89348e7ecac292a843ddd",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -7135,7 +7065,7 @@
"phpdocumentor/reflection-docblock": "<5.2|>=7", "phpdocumentor/reflection-docblock": "<5.2|>=7",
"phpdocumentor/type-resolver": "<1.5.1", "phpdocumentor/type-resolver": "<1.5.1",
"symfony/dependency-injection": "<6.4", "symfony/dependency-injection": "<6.4",
"symfony/property-access": "<6.4", "symfony/property-access": "<6.4.31|>=7.0,<7.4.2|>=8.0,<8.0.2",
"symfony/property-info": "<6.4", "symfony/property-info": "<6.4",
"symfony/type-info": "<7.2.5", "symfony/type-info": "<7.2.5",
"symfony/uid": "<6.4", "symfony/uid": "<6.4",
@ -7157,7 +7087,7 @@
"symfony/http-kernel": "^6.4|^7.0|^8.0", "symfony/http-kernel": "^6.4|^7.0|^8.0",
"symfony/messenger": "^6.4|^7.0|^8.0", "symfony/messenger": "^6.4|^7.0|^8.0",
"symfony/mime": "^6.4|^7.0|^8.0", "symfony/mime": "^6.4|^7.0|^8.0",
"symfony/property-access": "^6.4|^7.0|^8.0", "symfony/property-access": "^6.4.31|^7.4.2|^8.0.2",
"symfony/property-info": "^6.4|^7.0|^8.0", "symfony/property-info": "^6.4|^7.0|^8.0",
"symfony/translation-contracts": "^2.5|^3", "symfony/translation-contracts": "^2.5|^3",
"symfony/type-info": "^7.2.5|^8.0", "symfony/type-info": "^7.2.5|^8.0",
@ -7193,7 +7123,7 @@
"description": "Handles serializing and deserializing data structures, including object graphs, into array structures or other formats like XML and JSON.", "description": "Handles serializing and deserializing data structures, including object graphs, into array structures or other formats like XML and JSON.",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/serializer/tree/v7.4.8" "source": "https://github.com/symfony/serializer/tree/v7.4.10"
}, },
"funding": [ "funding": [
{ {
@ -7213,7 +7143,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2026-03-30T21:34:42+00:00" "time": "2026-05-03T13:03:28+00:00"
}, },
{ {
"name": "symfony/service-contracts", "name": "symfony/service-contracts",
@ -7304,16 +7234,16 @@
}, },
{ {
"name": "symfony/string", "name": "symfony/string",
"version": "v8.0.8", "version": "v8.0.11",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/string.git", "url": "https://github.com/symfony/string.git",
"reference": "ae9488f874d7603f9d2dfbf120203882b645d963" "reference": "39be2ad058a3c0bd558edca23e65f009865d75ff"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/string/zipball/ae9488f874d7603f9d2dfbf120203882b645d963", "url": "https://api.github.com/repos/symfony/string/zipball/39be2ad058a3c0bd558edca23e65f009865d75ff",
"reference": "ae9488f874d7603f9d2dfbf120203882b645d963", "reference": "39be2ad058a3c0bd558edca23e65f009865d75ff",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -7370,7 +7300,7 @@
"utf8" "utf8"
], ],
"support": { "support": {
"source": "https://github.com/symfony/string/tree/v8.0.8" "source": "https://github.com/symfony/string/tree/v8.0.11"
}, },
"funding": [ "funding": [
{ {
@ -7390,7 +7320,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2026-03-30T15:14:47+00:00" "time": "2026-05-13T12:07:53+00:00"
}, },
{ {
"name": "symfony/translation", "name": "symfony/translation",
@ -8186,23 +8116,23 @@
}, },
{ {
"name": "webmozart/assert", "name": "webmozart/assert",
"version": "1.12.1", "version": "2.3.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/webmozarts/assert.git", "url": "https://github.com/webmozarts/assert.git",
"reference": "9be6926d8b485f55b9229203f962b51ed377ba68" "reference": "eb0d790f735ba6cff25c683a85a1da0eadeff9e4"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/webmozarts/assert/zipball/9be6926d8b485f55b9229203f962b51ed377ba68", "url": "https://api.github.com/repos/webmozarts/assert/zipball/eb0d790f735ba6cff25c683a85a1da0eadeff9e4",
"reference": "9be6926d8b485f55b9229203f962b51ed377ba68", "reference": "eb0d790f735ba6cff25c683a85a1da0eadeff9e4",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"ext-ctype": "*", "ext-ctype": "*",
"ext-date": "*", "ext-date": "*",
"ext-filter": "*", "ext-filter": "*",
"php": "^7.2 || ^8.0" "php": "^8.2"
}, },
"suggest": { "suggest": {
"ext-intl": "", "ext-intl": "",
@ -8212,7 +8142,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "1.10-dev" "dev-feature/2-0": "2.0-dev"
} }
}, },
"autoload": { "autoload": {
@ -8228,6 +8158,10 @@
{ {
"name": "Bernhard Schussek", "name": "Bernhard Schussek",
"email": "bschussek@gmail.com" "email": "bschussek@gmail.com"
},
{
"name": "Woody Gilk",
"email": "woody.gilk@gmail.com"
} }
], ],
"description": "Assertions to validate method input/output with nice error messages.", "description": "Assertions to validate method input/output with nice error messages.",
@ -8238,9 +8172,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/webmozarts/assert/issues", "issues": "https://github.com/webmozarts/assert/issues",
"source": "https://github.com/webmozarts/assert/tree/1.12.1" "source": "https://github.com/webmozarts/assert/tree/2.3.0"
}, },
"time": "2025-10-29T15:56:20+00:00" "time": "2026-04-11T10:33:05+00:00"
} }
], ],
"packages-dev": [ "packages-dev": [
@ -9284,16 +9218,16 @@
}, },
{ {
"name": "laravel/sail", "name": "laravel/sail",
"version": "v1.58.0", "version": "v1.59.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/laravel/sail.git", "url": "https://github.com/laravel/sail.git",
"reference": "2e5e968138ca52ed87d712449697a8364d73b466" "reference": "a41abad557e487eaefde6c9873085ed086fdf47a"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/laravel/sail/zipball/2e5e968138ca52ed87d712449697a8364d73b466", "url": "https://api.github.com/repos/laravel/sail/zipball/a41abad557e487eaefde6c9873085ed086fdf47a",
"reference": "2e5e968138ca52ed87d712449697a8364d73b466", "reference": "a41abad557e487eaefde6c9873085ed086fdf47a",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -9343,7 +9277,7 @@
"issues": "https://github.com/laravel/sail/issues", "issues": "https://github.com/laravel/sail/issues",
"source": "https://github.com/laravel/sail" "source": "https://github.com/laravel/sail"
}, },
"time": "2026-04-27T13:38:34+00:00" "time": "2026-05-13T14:02:20+00:00"
}, },
{ {
"name": "mockery/mockery", "name": "mockery/mockery",
@ -11553,16 +11487,16 @@
}, },
{ {
"name": "symfony/yaml", "name": "symfony/yaml",
"version": "v8.0.8", "version": "v8.0.11",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/yaml.git", "url": "https://github.com/symfony/yaml.git",
"reference": "54174ab48c0c0f9e21512b304be17f8150ccf8f1" "reference": "48046fbd5567bd1717f278eaa2cfc3131f489984"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/yaml/zipball/54174ab48c0c0f9e21512b304be17f8150ccf8f1", "url": "https://api.github.com/repos/symfony/yaml/zipball/48046fbd5567bd1717f278eaa2cfc3131f489984",
"reference": "54174ab48c0c0f9e21512b304be17f8150ccf8f1", "reference": "48046fbd5567bd1717f278eaa2cfc3131f489984",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -11604,7 +11538,7 @@
"description": "Loads and dumps YAML files", "description": "Loads and dumps YAML files",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/yaml/tree/v8.0.8" "source": "https://github.com/symfony/yaml/tree/v8.0.11"
}, },
"funding": [ "funding": [
{ {
@ -11624,7 +11558,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2026-03-30T15:14:47+00:00" "time": "2026-05-13T12:07:53+00:00"
}, },
{ {
"name": "ta-tikoma/phpunit-architecture-test", "name": "ta-tikoma/phpunit-architecture-test",

View File

@ -1,19 +1,24 @@
<?php <?php
use App\Data\ConnectedApp\ConnectionStatusData;
use App\Enums\ConnectionStatusEnum;
use App\Livewire\Forms\StoreConnectedAppFrom; use App\Livewire\Forms\StoreConnectedAppFrom;
use App\Models\ConnectionProtocol; use App\Models\ConnectionProtocol;
use App\Models\ConnectionProvider; use App\Models\ConnectionProvider;
use App\Models\ConnectionStatus; use App\Models\ConnectionStatus;
use App\Services\ConnectionProtocolService; use App\Services\ConnectionProtocolService;
use App\Services\ConnectionProviderService; use App\Services\ConnectionProviderService;
use App\Services\ConnectionStatusService;
use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Collection;
use Livewire\Attributes\Computed; use Livewire\Attributes\Computed;
use Livewire\Component; use Livewire\Component;
use Livewire\Attributes\Title; use Livewire\Attributes\Title;
use Spatie\LaravelData\DataCollection;
new new
#[Title('Create a service')] #[Title('Create a service')]
class extends Component { class extends Component {
public StoreConnectedAppFrom $form; public StoreConnectedAppFrom $form;
#[Computed] #[Computed]
@ -35,13 +40,17 @@ public function protocols(): Collection
} }
/** /**
* @returns Collection<int, ConnectionStatus> * @returns DataCollection<int, ConnectionStatus>
*/ */
#[Computed] #[Computed]
public function connectionStatuses(): Collection public function connectionStatuses(): DataCollection
{ {
return ConnectionStatus::query()->get()->map(function (ConnectionStatus $status) { $statusService = app(ConnectionStatusService::class);
$status->name = ucfirst($status->name);
return $statusService->getAll()->map(function (ConnectionStatusData $status) {
if ($status->name === ConnectionStatusEnum::Disconnected) {
$this->form->statusId = $status->id;
}
return $status; return $status;
}); });
} }
@ -54,7 +63,11 @@ public function searchProvider(string $name)
public function save() public function save()
{ {
try {
$this->form->save(); $this->form->save();
} catch (Throwable $e) {
\Illuminate\Support\Facades\Log::error('Error while submitting Create a connected app', [$e->getMessage()]);
}
} }
}; };
?> ?>
@ -63,17 +76,16 @@ public function save()
<x-shared.card :title="__('Create a service')" class=""> <x-shared.card :title="__('Create a service')" class="">
<form wire:submit="save" class="p-4 grid grid-cols-1 gap-4 md:grid-cols-2"> <form wire:submit="save" class="p-4 grid grid-cols-1 gap-4 md:grid-cols-2">
<x-input wire:model.live.blur="form.name" required :label="__('Name')"/> <x-input wire:model.live.blur="form.name" required :label="__('Name')"/>
<x-input wire:model.live.blur="form.logoUrl" :label="__('Logo Link')"/>
<x-choices <x-choices
required required
wire:model.live="form.protocolId" wire:model="form.protocolId"
:label="__('Protocol')" :label="__('Protocol')"
:single="true" :single="true"
:options="$this->protocols" :options="$this->protocols"
placeholder="Select" placeholder="Select"
/> />
<x-choices required <x-choices required
wire:model.live="form.providerId" wire:model="form.providerId"
:label="__('Provider')" :label="__('Provider')"
placeholder="Search ..." placeholder="Search ..."
:single="true" :single="true"
@ -84,10 +96,10 @@ public function save()
/> />
<x-choices <x-choices
required required
wire:model.live="form.statusId" wire:model="form.statusId"
:label="__('Status')" :label="__('Status')"
:single="true" :single="true"
:options="$this->connectionStatuses" :options="$this->connectionStatuses->toArray()"
placeholder="Select" placeholder="Select"
/> />
<div class="md:col-span-2 flex gap-x-4 font-medium justify-end"> <div class="md:col-span-2 flex gap-x-4 font-medium justify-end">