38 lines
1.3 KiB
PHP
38 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Team;
|
|
|
|
use App\Models\CollectionTeam;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
class StoreCollectionTeamRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'name' => ['required', 'string', 'max:191'],
|
|
'area_id' => ['nullable', 'integer', 'exists:service_areas,id'],
|
|
'driver_id' => ['nullable', 'integer', 'exists:users,id'],
|
|
'scanner_id' => ['nullable', 'integer', 'exists:users,id'],
|
|
'truck_id' => ['nullable', 'integer', 'exists:trucks,id'],
|
|
'helper_ids' => ['nullable', 'array'],
|
|
'helper_ids.*' => ['integer', 'exists:users,id'],
|
|
'helper_count' => ['nullable', 'integer', 'min:0', 'max:10'],
|
|
'helper_assignment_mode' => ['nullable', 'string', Rule::in(['random', 'manual'])],
|
|
'status' => ['nullable', Rule::in([
|
|
CollectionTeam::STATUS_ACTIVE,
|
|
CollectionTeam::STATUS_INACTIVE,
|
|
CollectionTeam::STATUS_STANDBY,
|
|
])],
|
|
'notes' => ['nullable', 'string', 'max:1000'],
|
|
'override_conflicts' => ['nullable', 'boolean'],
|
|
];
|
|
}
|
|
}
|