/** * удаление новости */ protected function actionDel() { $news = new News(); $news->id = $_GET['id']; $news->delete(); header('Location: /'); }
public function actionKill() { $id = isset($_GET['id']) ? (int) $_GET['id'] : null; if (is_null($id)) { header("HTTP/1.0 404 Not Found"); throw new E404Exception('Requested param cannot be null'); } $NewsRecord = new News(); $NewsRecord->NewsId = $id; $NewsRecord->delete(); header('Location: ./index.php'); }
/** * Remove the specified resource from storage. * * @param News $news * @return \Illuminate\Http\Response * @throws \Exception * @internal param int $id */ public function destroy(News $news) { $news->delete(); return redirect()->route('admin.news.index'); }