Agent::where('integration_status', IntegrationStatus::Completed)->get(), 'current_offboardings' => IntegrationRequest::where('type', 'offboarding') ->with(['agent', 'template']) ->get(), ]); } public function create(Agent $agent) { return Inertia::render('Offboarding/Create', [ 'agent' => $agent, 'templates' => IntegrationTemplate::where('is_active', true)->get(), ]); } public function store(Request $request, IntegrationService $service) { $validated = $request->validate([ 'agent_id' => 'required|exists:agents,id', 'template_id' => 'nullable|exists:integration_templates,id', 'departure_date' => 'required|date', ]); $integration = $service->createProcess([ 'agent_id' => $validated['agent_id'], 'template_id' => $validated['template_id'], 'type' => 'offboarding', 'departure_date' => $validated['departure_date'], ]); return redirect()->route('integrations.show', $integration); } }