Ejemplo n.º 1
0
 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']);
 }
Ejemplo n.º 2
0
 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';
     }
 }
Ejemplo n.º 3
0
 /**
  * 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');
 }