schneespur/app/Http/Requests/Driver/StoreManualJobRequest.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

46 lines
1.3 KiB
PHP

<?php
namespace App\Http\Requests\Driver;
use App\Enums\JobType;
use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class StoreManualJobRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
/**
* @return array<string, ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'customer_object_id' => ['required', 'exists:customer_objects,id'],
'type' => ['required', Rule::enum(JobType::class)],
'started_at' => ['required', 'date', 'before_or_equal:now'],
'ended_at' => ['required', 'date', 'after:started_at', 'before_or_equal:now'],
'notes' => ['nullable', 'string', 'max:1000'],
'vehicle_id' => ['nullable', 'exists:vehicles,id'],
];
}
/**
* @return array<string, string>
*/
public function attributes(): array
{
return [
'customer_object_id' => __('job.field_object'),
'type' => __('job.field_type'),
'started_at' => __('job.field_started_at'),
'ended_at' => __('job.field_ended_at'),
'notes' => __('job.field_notes'),
'vehicle_id' => __('job.field_vehicle'),
];
}
}