- Introduced `StoreURLAppForm` and `StoreURLAppData` for form handling and data transformation. - Added `UrlAppService` to streamline URL app creation with settings like `accessUrl` and `isConnectedToMicrosoft`. - Enhanced user access controls with role-based permissions using `UserAccessTypeEnum`. - Updated UI for URL app creation with support for logos and dynamic role selection. - Implemented feature tests to validate URL app creation and access URL formatting.
46 lines
1.2 KiB
PHP
46 lines
1.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Livewire\Forms;
|
|
|
|
use App\Enums\UserAccessTypeEnum;
|
|
use Livewire\Attributes\Validate;
|
|
use Livewire\Features\SupportFileUploads\TemporaryUploadedFile;
|
|
use Livewire\Form;
|
|
|
|
class StoreURLAppForm extends Form
|
|
{
|
|
#[Validate('required|string|max:255|min:3')]
|
|
public string $name = '';
|
|
|
|
#[Validate('required|url|max:255')]
|
|
public string $accessUrl = '';
|
|
|
|
#[Validate('boolean')]
|
|
public bool $isConnectedToMicrosoft = false;
|
|
|
|
#[Validate('nullable|image|max:1024')]
|
|
public ?TemporaryUploadedFile $logo = null;
|
|
|
|
#[Validate([
|
|
'userAccessOption' => 'required|in:'.UserAccessTypeEnum::Everyone->value.','.UserAccessTypeEnum::Role->value,
|
|
])]
|
|
public string $userAccessOption = UserAccessTypeEnum::Everyone->value;
|
|
|
|
/** @var int[] */
|
|
#[Validate([
|
|
'roleIds' => 'required_if:userAccessOption,'.UserAccessTypeEnum::Role->value,
|
|
'roleIds.*' => ['integer', 'exists:roles,id'],
|
|
])]
|
|
public array $roleIds = [];
|
|
|
|
public function validationAttributes(): array
|
|
{
|
|
return [
|
|
'accessUrl' => 'Access URL',
|
|
'roleIds.*' => 'Role',
|
|
];
|
|
}
|
|
}
|