feat: Phase 2 - page CRUD, subscriber management, user management
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Requests\Admin;
|
||||
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
|
||||
trait ValidatesPreregistrationPageInput
|
||||
{
|
||||
/**
|
||||
* @return array<string, array<int, ValidationRule|string>>
|
||||
*/
|
||||
protected function preregistrationPageRules(): array
|
||||
{
|
||||
return [
|
||||
'title' => ['required', 'string', 'max:255'],
|
||||
'heading' => ['required', 'string', 'max:255'],
|
||||
'intro_text' => ['nullable', 'string'],
|
||||
'thank_you_message' => ['nullable', 'string'],
|
||||
'expired_message' => ['nullable', 'string'],
|
||||
'ticketshop_url' => ['nullable', 'string', 'url:http,https', 'max:255'],
|
||||
'start_date' => ['required', 'date'],
|
||||
'end_date' => ['required', 'date', 'after:start_date'],
|
||||
'phone_enabled' => ['sometimes', 'boolean'],
|
||||
'is_active' => ['sometimes', 'boolean'],
|
||||
'background_image' => ['nullable', 'image', 'mimes:jpeg,png,jpg,webp', 'max:5120'],
|
||||
'logo_image' => ['nullable', 'file', 'mimes:jpeg,png,jpg,webp,svg', 'max:2048'],
|
||||
];
|
||||
}
|
||||
|
||||
protected function preparePreregistrationPageFields(): void
|
||||
{
|
||||
$ticketshop = $this->input('ticketshop_url');
|
||||
$ticketshopNormalized = null;
|
||||
if (is_string($ticketshop) && trim($ticketshop) !== '') {
|
||||
$ticketshopNormalized = trim($ticketshop);
|
||||
}
|
||||
|
||||
$this->merge([
|
||||
'phone_enabled' => $this->boolean('phone_enabled'),
|
||||
'is_active' => $this->boolean('is_active'),
|
||||
'ticketshop_url' => $ticketshopNormalized,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user