public function crearPlanillaNormal($viaje_id, $central_id, $total) { $planilla = new Planilla(); $planilla->viaje_id = $viaje_id; $planilla->central_id = $central_id; $planilla->total = $total; $planilla->numero_planilla = $this->generarNumeroPlanillaNormal($central_id); if ($planilla->save()) { $planilla['tipo'] = 'normal'; return $planilla; } else { $planilla->delete(); return JsonResponse::create('Error al crear la planilla'); } }