/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { $idMidia = Midia::where('id_registro_tabela', $id)->where('id_tipo_midia', $this->tipo_midia)->first()->id_midia; $dados['imagens'] = Midia::find($idMidia)->multimidia()->where('id_midia', $idMidia)->get(); $dados['dados'] = Programa::findOrFail($id); return view('programa', $dados); }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Programa::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, 'ejeid' => $this->ejeid, 'usuariocrea' => $this->usuariocrea, 'fechacrea' => $this->fechacrea, 'usuariomodifica' => $this->usuariomodifica, 'fechamodifica' => $this->fechamodifica]); $query->andFilterWhere(['like', 'programa', $this->programa]); return $dataProvider; }
protected function postEditarPrograma(Request $request) { $this->validate($request, ['numero_programa' => 'required', 'nombre_programa' => 'required', 'tipo' => 'required', 'usuario_responsable' => 'required']); $anteriorNumero_programa = $request['anteriorNumero_programa']; $numero_de_programa = $request['numero_programa']; $nombre = $request['nombre_programa']; $tipo = $request['tipo']; $observaciones = $request['observaciones']; $usuario_responsable = $request['usuario_responsable']; $en_ejecucion = $request['en_ejecucion']; //$usuarioEditor = Session::get('usuario.correo'); if ($programaActualizado = Programa::where('numero_de_programa', $anteriorNumero_programa)->update(['numero_de_programa' => $numero_de_programa, 'nombre' => $nombre, 'observaciones' => $observaciones, 'usuario_responsable' => $usuario_responsable, 'en_ejecucion' => $en_ejecucion])) { return redirect('listarPrograma')->with('success', 'programa editado correctamente'); } else { return redirect('listarUsuario')->with('error', 'cava NO editada correctamente'); } }
protected function getEditarFlujoBodega(Request $request) { //1.obtener bodega del flujo //2.obtener id del flujo de bodega //3.buscar flujo de bodega //4.enviar flujo de bodega a vista de editar flujo de bodega $codigo_bodega = $request['codigo_bodega']; $id_flujo_bodega = $request['id_flujo_bodega']; $flujo_de_bodega = FlujoDeBodega::where('bodega', $codigo_bodega)->get(); $flujo_de_bodega = FlujoDeBodega::where('id', $id_flujo_bodega)->get(); $flujo_de_bodega = $flujo_de_bodega[0]; $materiasPrimas = MateriaPrima::all(); $programas = Programa::all(); $usuarios = Usuario::all(); $bodegas = Bodega::all(); //INFORMACION ADICIONAL PARA MOSTRAR EN VISTA DE EDITAR FLUJO DE BODEGA //1.unidad de medida de tipo de materia prima del flujo de bodega //2.nombre de programa del flujo de bodega //3.nombre de usuario responsable del flujo de bodega //4.rol de usuario responsable del flujo de bodega //5.tipo de bodega del flujo de bodega //1. $unidad_medida_materia_prima = MateriaPrima::select('unidad_de_medida')->where('nombre', $flujo_de_bodega->materia_prima)->get(); $unidad_medida_materia_prima = $unidad_medida_materia_prima[0]->unidad_de_medida; //2. $nombre_de_programa = Programa::select('nombre')->where('numero_de_programa', $flujo_de_bodega->programa)->get(); $nombre_de_programa = $nombre_de_programa[0]->nombre; //3. $nombre_de_responsable = Usuario::select('nombre')->where('correo', $flujo_de_bodega->usuario_responsable)->get(); $nombre_de_responsable = $nombre_de_responsable[0]->nombre; //4. $rol_de_responsable = Usuario::select('rol')->where('correo', $flujo_de_bodega->usuario_responsable)->get(); $rol_de_responsable = $rol_de_responsable[0]->rol; //5. $tipo_bodega = Bodega::select('tipo')->where('codigo', $flujo_de_bodega->bodega)->get(); $tipo_bodega = $tipo_bodega[0]->tipo; $vectorINFO[1] = $unidad_medida_materia_prima; $vectorINFO[2] = $nombre_de_programa; $vectorINFO[3] = $nombre_de_responsable; $vectorINFO[4] = $rol_de_responsable; $vectorINFO[5] = $tipo_bodega; return view("FlujoBodega/editarFlujoBodega", compact('flujo_de_bodega', 'materiasPrimas', 'programas', 'usuarios', 'bodegas', 'vectorINFO', 'id_flujo_bodega')); }
/** * @return \yii\db\ActiveQuery */ public function getPrograma() { return $this->hasOne(Programa::className(), ['id' => 'programaid']); }
/** * @return \yii\db\ActiveQuery */ public function getProgramas() { return $this->hasMany(Programa::className(), ['ejeid' => 'id']); }
/** * Finds the Programa model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Programa the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Programa::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
public function updateStatus($status, $id) { try { $dado = Programa::findOrFail($id); $dado->status = $status; $dado->save(); session()->flash('flash_message', 'Status alterado com sucesso!'); } catch (\Exception $e) { LogR::exception($dado, $e); session()->flash('flash_message', 'Ops!! Ocorreu algum problema!. ' . $e->getMessage()); } return Redirect::back(); }
public function eliminar($params) { $facultad = new Entity(); $facultad->delete('id_programas', $params['id']); Redirect::action('ProgramaController@index'); }