Example #1
0
 public function postReply($id = 0)
 {
     $parent = TalkPost::findOrFail($id);
     if ($parent) {
         $input = (object) Input::only('content');
         $post = new TalkPost();
         $post->title = '';
         $post->content = $input->content;
         $post->category_id = $parent->category_id;
         $post->parent_id = $parent->id;
         $post->user_id = Auth::user()->id;
     }
     if ($post->save()) {
         return Redirect::to(Config::get('talk::routes.base') . '/read/' . $parent->slug . '/#post-' . $post->id);
     }
 }
Example #2
0
 public function getIndex()
 {
     $tags = TalkTag::orderBy('name')->whereActive(1)->get();
     $categories = TalkCategory::orderBy('name')->whereActive(1)->get();
     $posts = TalkPost::orderBy('created_at', 'DESC')->whereParent_id(0)->take(10)->get();
     $this->layout->content = View::make('talk::home.index')->with('tags', $tags)->with('posts', $posts)->with('categories', $categories);
 }
Example #3
0
 public function missingMethod($parameters = array())
 {
     $post = TalkPost::whereSlug($parameters[0])->first();
     if (null != $post) {
         $comments = TalkPost::where('parent_id', '=', $post->id)->get();
         $this->layout->content = View::make('talk::read.post', compact('post', 'comments'));
     }
 }
Example #4
0
 public function index()
 {
     $posts = TalkPost::paginate(15);
     $this->layout->content = View::make('talk::admin.posts.index', compact('posts'));
 }
Example #5
0
 public function getIndex()
 {
     $posts = TalkPost::whereParent_id(0)->orderBy('created_at', 'DESC')->paginate(15);
     $this->layout->content = View::make('talk::list.index', compact('posts'));
 }