27 lines
756 B
PHP
27 lines
756 B
PHP
<?php
|
|
|
|
namespace App\Domains\Integration\Requests;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class UpdateIntegrationRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
$integration = $this->route('integration');
|
|
|
|
return [
|
|
'name' => ['sometimes', 'required', 'string', 'max:255'],
|
|
'url' => ['nullable', 'url', 'max:255'],
|
|
'integration_data_schema' => ['nullable', 'array'],
|
|
// the code shouldn't ideally be updatable, but if it is:
|
|
'integration_code' => ['sometimes', 'required', 'string', 'unique:integrations,integration_code,' . ($integration->id ?? '')],
|
|
];
|
|
}
|
|
}
|