Example #1
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $noticia = Noticia::find($id);
     $noticia->delete();
     return response()->json(["mensaje" => 'eliminado']);
 }
Example #2
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $noticia = Noticia::find($id);
     $file = 'file/' . $noticia->path;
     $noticia->delete();
     if (File::exists($file)) {
         unlink($file);
     }
     return response()->json(["mensaje" => 'eliminado']);
 }