public function index() { $logger = new \framework\core\Log('haohongtest.log'); $logger->info("haha"); $postModel = new PostModel(); $posts = $postModel->find(['userId' => 333]); dd($posts); // $this->view->setLayout('layouts/default'); // $this->view->render('index/index', ['name' => 'haohong']); }
public function storeComment($postId) { // $rules = array('name' => 'required', 'content' => 'required'); // $input = Input::all(); // $validation = Validator::make($input, $rules); $rules = array('title' => 'required', 'slug' => 'required'); $validation = Validator::make(Input::all(), $rules); $input = Input::except('enable_preview_content', 'tags'); if ($validation) { $comment = PostModel::find($postId)->comment()->create($input); return redirect()->route('blog.show', $comment->post->slug); } else { //return redirect()->route('blog.show', $comment->post->slug); echo 'tambah komentar gagal'; } }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { PostModel::find($id)->delete(); return redirect()->route('admin.post.index')->with('success_msg', 'Succesfully deleted post'); }