public function destroy($id) { $carreras = Carrera::find($id); $carreras->delete(); Session::flash('message', 'La ' . $carreras->nombre . ' fue eliminada'); return redirect()->route('Administrador.carreras.index'); }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Carrera::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'id_area' => $this->id_area]); $query->andFilterWhere(['like', 'nombre', $this->nombre]); return $dataProvider; }
public function show($id) { $carreras = Carrera::find($id); //dd($Campus); if ($carreras) { $data = array(array('codigo', 'nombre', 'descripcion', 'escuela_id'), array($carreras->codigo, $carreras->nombre, $carreras->descripcion, $carreras->escuelas->nombre)); Excel::create('Carreras' . $carreras->nombre, function ($excel) use($data) { $excel->sheet('Sheetname', function ($sheet) use($data) { $sheet->fromArray($data); }); })->download('csv'); } else { abort('404'); } }
public function actionSistemaExperto($id) { $negocio = new RespuestaExamenNegocio(); $perfil = $negocio->procesarRespuestas($id); $resultadosExamen = new ResultadosExamen(); $dataProvider = new ActiveDataProvider(['query' => ResultadosExamen::find()->where(['id_inscripcion' => $id])->orderBy(['id_area' => SORT_ASC])]); if ($perfil != null) { $valor = $perfil->getValor(); } else { $valor = 'no se encontro un resultado'; } if (strcasecmp($valor, \app\SistemaExperto\backwardchain::$DEFINIDO) == 0) { $profesion = $negocio->encontrarArea($id); $carrera = new ActiveDataProvider(['query' => Carrera::find()->where(['id_area' => $profesion->id_area])]); } else { $profesion = null; $carrera = null; } return $this->render('resultado', ['dataProvider' => $dataProvider, 'perfil' => $valor, 'profesion' => $profesion, 'carrera' => $carrera]); }