schneespur/app/Http/Requests/Admin/UpdateCustomerRequest.php
Michael ee3dbba6cc Initial release v1.0.0
Schneespur — Open-source winter service documentation software (PWA + Admin).
GPS tracking via OwnTracks, weather data, photo evidence, and legally
compliant service records for winter maintenance operators.

License: AGPL-3.0-or-later
2026-05-17 13:33:51 +00:00

53 lines
1.6 KiB
PHP

<?php
namespace App\Http\Requests\Admin;
use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Foundation\Http\FormRequest;
class UpdateCustomerRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
/**
* @return array<string, ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'name' => ['required', 'string', 'max:200'],
'contact_name' => ['nullable', 'string', 'max:200'],
'email' => ['nullable', 'email', 'max:200'],
'phone' => ['nullable', 'string', 'max:50'],
'auto_notify_email' => ['boolean'],
'notification_email' => ['nullable', 'required_if:auto_notify_email,1', 'email', 'max:200'],
'locale' => ['sometimes', 'in:de,en'],
];
}
public function messages(): array
{
return [
'notification_email.required_if' => __('customer.validation_notification_email_required'),
];
}
/**
* @return array<string, string>
*/
public function attributes(): array
{
return [
'name' => __('customer.field_name'),
'contact_name' => __('customer.field_contact_name'),
'email' => __('customer.field_email'),
'phone' => __('customer.field_phone'),
'auto_notify_email' => __('customer.field_auto_notify'),
'notification_email' => __('customer.field_notification_email'),
'locale' => __('customer.field_locale'),
];
}
}