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.
40 lines
1.1 KiB
PHP
40 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Modules\Import\Requests;
|
|
|
|
use Closure;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Http\UploadedFile;
|
|
|
|
class ClientImportRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
// Validate by extension only — Windows CSV exports arrive with a
|
|
// variety of MIME types (text/plain, application/vnd.ms-excel), so a
|
|
// strict `mimes:csv` rule would reject legitimate files.
|
|
'file' => [
|
|
'required',
|
|
'file',
|
|
'max:10240',
|
|
function (string $attribute, mixed $value, Closure $fail): void {
|
|
$ext = $value instanceof UploadedFile
|
|
? strtolower($value->getClientOriginalExtension())
|
|
: '';
|
|
if (! in_array($ext, ['csv', 'txt'], true)) {
|
|
$fail('Bitte eine CSV-Datei (.csv oder .txt) hochladen.');
|
|
}
|
|
},
|
|
],
|
|
];
|
|
}
|
|
}
|