Mirrors the frontend catch-up in 570f17e: a substantial amount of
finished-but-never-committed backend work had accumulated locally.
- New CustomField module: admin-managed field definitions per client,
reorderable, typed values stored per client (backing the frontend's
ClientCustomFieldCard + settings/fields page)
- History entries switch from a hardcoded type enum to a dynamic,
admin-managed HistoryType module (reorderable, backing
settings/history-types)
- New Import module: CSV client import (backing settings/import)
- Clients table gains soft deletes (deleted_at)
- Supporting factories, seeders, policies, and feature tests for all
of the above
All 63 backend tests pass locally before this commit.
41 lines
1.3 KiB
PHP
41 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Modules\History\Requests;
|
|
|
|
use App\Modules\History\Models\HistoryType;
|
|
use Illuminate\Contracts\Validation\Validator;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class CreateHistoryEntryRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool { return true; }
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'history_entry_type_id' => ['required', 'integer', 'exists:history_types,id'],
|
|
'body' => ['required', 'string', 'max:65535'],
|
|
// The picker emits a naive local datetime; presence is enforced
|
|
// conditionally below based on the chosen type.
|
|
'occurred_at' => ['nullable', 'date_format:Y-m-d\TH:i:s'],
|
|
];
|
|
}
|
|
|
|
public function withValidator(Validator $validator): void
|
|
{
|
|
$validator->after(function (Validator $validator) {
|
|
$typeId = $this->input('history_entry_type_id');
|
|
if (! $typeId) {
|
|
return;
|
|
}
|
|
|
|
$type = HistoryType::find($typeId);
|
|
if ($type && $type->requires_datetime && ! $this->filled('occurred_at')) {
|
|
$validator->errors()->add(
|
|
'occurred_at',
|
|
'Für diesen Verlaufstyp sind Datum und Uhrzeit erforderlich.'
|
|
);
|
|
}
|
|
});
|
|
}
|
|
}
|