コード例 #1
0
 /**
  * Remove the specified Notice from storage.
  *
  * @param  int $id
  *
  * @return Response
  */
 public function destroy($id)
 {
     $notice = $this->noticeRepository->find($id);
     if (empty($notice)) {
         Flash::error('Noticia no encontrada.');
         return redirect(route('noticias.index'));
     }
     $this->noticeRepository->delete($id);
     if (file_exists($notice->imagen)) {
         unlink($notice->imagen);
     }
     Flash::success('Noticia borrada satisfactoriamente.');
     return redirect(route('noticias.index'));
 }
コード例 #2
0
 /**
  * Remove the specified Notice from storage.
  * DELETE /notices/{id}
  *
  * @param  int $id
  *
  * @return Response
  */
 public function destroy($id)
 {
     $this->noticeRepository->apiDeleteOrFail($id);
     return $this->sendResponse($id, "Notice deleted successfully");
 }