- Renamed `ConnectedServicesService` to `ConnectedAppService` and adjusted related factories, DTOs, and forms. - Introduced `ConnectionProtocolService` and `ConnectionProviderService` for managing protocols and providers. - Updated Livewire forms to improve validation and allow real-time provider searches. - Added a `ConnectionStatus` field and related dropdown to service connection forms. - Enhanced form handling with new services, search functionality, and validation rules. - Refactored factory and DTO structure for better consistency and modularity. - Added service layer documentation and streamlined component data mappings.
46 lines
1.2 KiB
PHP
46 lines
1.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Livewire\Forms;
|
|
|
|
use App\Data\ConnectedApp\ConnectAppRequest;
|
|
use App\Services\ConnectedAppService;
|
|
use Livewire\Attributes\Validate;
|
|
use Livewire\Form;
|
|
|
|
class StoreConnectedAppFrom extends Form
|
|
{
|
|
#[Validate('required|string|max:255|min:3')]
|
|
public string $name = '';
|
|
|
|
#[Validate('required|numeric|min:1|exists:connection_providers,id')]
|
|
public int $providerId = 0;
|
|
|
|
#[Validate('required|numeric|min:1|exists:connection_protocols,id')]
|
|
public int $protocolId = 0;
|
|
|
|
#[Validate('required|numeric|min:1|exists:connection_statuses,id')]
|
|
public int $statusId = 0;
|
|
|
|
#[Validate('nullable|string|max:255|min:3')]
|
|
public ?string $logoUrl = null;
|
|
|
|
public function save(): void
|
|
{
|
|
$this->validate();
|
|
|
|
$serviceData = new ConnectAppRequest(
|
|
name: $this->name,
|
|
connectionProviderId: $this->providerId,
|
|
connectionProtocolId: $this->protocolId,
|
|
logoUrl: $this->logoUrl,
|
|
slug: str($this->name)->slug()->toString(),
|
|
statusId: $this->statusId,
|
|
);
|
|
|
|
app(ConnectedAppService::class)->create($serviceData);
|
|
$this->reset();
|
|
}
|
|
}
|