コード例 #1
0
ファイル: TalkHomeController.php プロジェクト: micro/talk
 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);
 }
コード例 #2
0
ファイル: TalkWriteController.php プロジェクト: micro/talk
 public function getIndex()
 {
     // get available Tags
     $tags = TalkTag::select('id', 'name')->whereActive(1)->lists('name', 'id');
     // get available Categories
     $categories = TalkCategory::select('id', 'name')->whereActive(1)->lists('name', 'id');
     $this->layout->content = View::make('talk::write.index')->with('tags', $tags)->with('categories', $categories);
 }
コード例 #3
0
 public function missingMethod($parameters = array())
 {
     $category = TalkCategory::whereSlug($parameters[0])->whereActive(1)->first();
     $posts = null;
     if (null != $category) {
         $posts = $category->posts()->whereParent_id(0)->paginate(15);
     }
     $this->layout->content = View::make('talk::categories.list', compact('posts'))->with('category', $category);
 }
コード例 #4
0
 public function destroy($id)
 {
     if (strtoupper(Input::get('delete')) == 'DELETE') {
         $category = TalkCategory::findOrFail($id);
         $category->delete();
         return Redirect::route(Config::get('talk::routes.base') . '.admin.categories.index');
     }
     return Redirect::route(Config::get('talk::routes.base') . '.admin.categories.show', $id);
 }