public function noticiaInfo($id) { $noticias = DB::select('select *, DATE_FORMAT(NT_FECHA,\'%d/%m/%Y\') as FECHA from noticias where NT_TIPO = \'detalle\' order by NT_FECHA DESC'); $noticias = array_slice($noticias, 0, 5); $noticia = Noticia::find($id); return view('website.noticiaInfo')->with('noticia', $noticia)->with('noticias', $noticias); }
public function ler($id) { $noticia = Noticia::find($id); return view('noticias.ler', ['noticia' => $noticia]); }
/** * Elimina un registro de la tabla noticia - Metodo destroy() * Realiza las validaciones usando el recurso \Validator * @param int $id - primary key tabla noticia * @return Redirecciona a la vista principal de noticia luego de eliminar el registro */ public function destroy($id) { $data = array('id_noticia' => "{$id}"); $rules = array('id_noticia' => 'exists:red_departamental,id_noticia'); $ifExistsNoticiaInRedDepartamentalTable = \Validator::make($data, $rules); if ($ifExistsNoticiaInRedDepartamentalTable->passes()) { return \Redirect::route('noticia')->with('ValidationNoticia', 'No se puede eliminar el registro seleccionado ya que la Noticia se encuentra presente en la Red Departamental.!'); } else { $noti = Noticia::find($id)->delete(); return \Redirect::route('noticia')->with('alert', 'Registro eliminado con exito!'); } }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { $boletin = Noticia::find($id); return view('adminpage.AdminBoletinUpdate')->with('boletin', $boletin); }
/** * Elimina un registro de la tabla noticia - Metodo destroy() * Realiza las validaciones usando el recurso \Validator * @param int $id - primary key tabla noticia * @return Redirecciona a la vista principal de noticia luego de eliminar el registro */ public function destroy($id) { $notic = Noticia::find($id)->delete(); return \Redirect::route('noticia')->with('alert', 'Registro eliminado con exito!'); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $noticia = Noticia::find($id); $noticia->delete(); \Storage::delete($noticia->imagen); return response()->json(['success' => true, 'message' => 'Noticia "' . $noticia->titulo . '" eliminada correctamente', 'id' => $noticia->id]); }