public function deletePage($id) { $page = Page::find($id); Page::destroy($id); Session::flash('flash_msg', "La page " . $page->titrePage . " a bien été supprimée."); Session::flash('flash_type', "warning"); return Redirect::to('/admin/pages'); }
/** * Remove the specified page from storage. * * @param int $id * @return Response */ public function destroy($id) { Page::destroy($id); return Redirect::route('admin.pages.index')->with('message', 'Data berhasil dihapus'); }
/** @test **/ public function it_destroys_the_model_with_the_given_id() { $this->createComponent('pages'); $this->insertOn('pages', ['title' => 'House', 'content' => 'Repeating']); $this->insertOn('pages', ['title' => 'Sherlock', 'content' => 'Elementary Watson.']); $this->insertOn('pages', ['title' => 'Psych!', 'content' => 'Repeating']); $this->assertEquals(3, Instance::count()); Page::destroy(2); $this->assertEquals(2, Instance::count()); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $page = Page::find($id); Page::destroy($id); return Redirect::to('admin/pages')->with(array('note' => 'Successfully Deleted Page', 'note_type' => 'success')); }