feat: Phase 3 - public registration pages and Mailwizz config

This commit is contained in:
2026-04-03 21:42:19 +02:00
parent cf026f46b0
commit a1d570254e
17 changed files with 1236 additions and 44 deletions

View File

@@ -0,0 +1,51 @@
<?php
declare(strict_types=1);
namespace App\Http\Requests\Admin;
use App\Models\PreregistrationPage;
use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class UpdateMailwizzConfigRequest extends FormRequest
{
public function authorize(): bool
{
$page = $this->route('page');
if (! $page instanceof PreregistrationPage) {
return false;
}
return $this->user()?->can('update', $page) ?? false;
}
/**
* @return array<string, array<int, ValidationRule|string>>
*/
public function rules(): array
{
/** @var PreregistrationPage $page */
$page = $this->route('page');
return [
'api_key' => [
Rule::requiredIf(fn (): bool => $page->mailwizzConfig === null),
'nullable',
'string',
'max:512',
],
'list_uid' => ['required', 'string', 'max:255'],
'list_name' => ['nullable', 'string', 'max:255'],
'field_email' => ['required', 'string', 'max:255'],
'field_first_name' => ['required', 'string', 'max:255'],
'field_last_name' => ['required', 'string', 'max:255'],
'field_phone' => $page->phone_enabled
? ['required', 'string', 'max:255']
: ['nullable', 'string', 'max:255'],
'tag_field' => ['required', 'string', 'max:255'],
'tag_value' => ['required', 'string', 'max:255'],
];
}
}