public function delete($page_id) { $page = Model\Portal\Page::findOrFail($page_id); $page->delete(); set_message_success('Halaman berhasil dihapus.'); redirect('pages', 'refresh'); }
/** * Run Method. * * Write your database seeder using this method. * * More information on writing seeders is available here: * http://docs.phinx.org/en/latest/seeding.html */ public function run() { $data = [['title' => 'About Us', 'slug' => 'about-us', 'content' => 'Please edit this page in administrator', 'date' => Carbon::now()], ['title' => 'Contact Us', 'slug' => 'contact-us', 'content' => 'Please edit this page in administrator', 'date' => Carbon::now()]]; Model\Portal\Page::truncate(); $table = $this->table('pages'); $table->insert($data)->save(); }
public function show($slug) { try { $page = Model\Portal\Page::whereSlug($slug)->firstOrFail(); $links = $this->Mod_link->read(); $this->template->set('single', TRUE); $this->template->set('sidebarCategory', TRUE); $this->template->set('railnews', FALSE); $this->template->set('sidebar', FALSE); $this->template->build('show', compact('page', 'links')); } catch (ModelNotFoundException $e) { } }