trucks (with optional last_known_coordinates POINT 4326), collection_teams, team_members. Admin CRUD for both. TeamConflictDetector flags double-assignment of driver/scanner/truck/helper across active teams; override_conflicts: true bypasses for emergencies. Promotes routes.default_team_id to a real FK now that collection_teams exists. 144 feature tests passing. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
29 lines
1.0 KiB
PHP
29 lines
1.0 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'],
|
|
'status' => ['nullable', Rule::in([CollectionTeam::STATUS_ACTIVE, CollectionTeam::STATUS_INACTIVE])],
|
|
'notes' => ['nullable', 'string', 'max:1000'],
|
|
'override_conflicts' => ['nullable', 'boolean'],
|
|
];
|
|
}
|
|
}
|