public function destroy($id) { if (!Author::destroy($id)) { return Redirect::back(); } return Redirect::route('admin.authors.index')->withPesan('Berhasil menghapus penulis'); }
/** * 先创建,再销毁一个对象 */ function testDestroyOne() { $author = new Author(array('name' => 'congcong - ' . mt_rand())); $author->save(); $id = $author->id(); $count = $this->_queryAuthorsCount(); $author->destroy(); $new_count = $this->_queryAuthorsCount(); $row = $this->_queryAuthor($id); $this->assertTrue(empty($row)); $this->assertEquals($new_count, $count - 1); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { Author::destroy($id); return Redirect::to('/authors'); }