Inheritance: extends Controller
 public function main()
 {
     if (\Auth::guest()) {
         return view('start');
     } else {
         $followees = FollowController::getFollowee();
         $comments = $this->getFolloweesComments($followees);
         //for header
         $headerData = CommentsController::header();
         return view('main', compact('headerData', 'comments'));
     }
 }
示例#2
0
 public static function getCounter($name)
 {
     $count['followee'] = FollowController::getCountFollowee($name);
     $count['follower'] = FollowController::getCountFollower($name);
     $count['comment'] = CommentsController::getCountComments($name);
     return $count;
 }
示例#3
0
 /**
  * @param $id
  * @return array
  */
 public function loadCategoryWithId($id)
 {
     $categories = Category::all();
     $category_list = Category::lists('name', 'id');
     $article = Article::findOrFail($id);
     $top_list_articles = Article::where('is_top', '=', 2)->get();
     // link the category id and the its related articles
     $articlesNumber = [];
     foreach ($categories as $category) {
         if (CategoriesController::getArticleNumber($category->id) != null) {
             $articlesNumber[$category->id] = CategoriesController::getArticleNumber($category->id)[0]->article_number;
         } else {
             $articlesNumber[$category->id] = '0';
         }
     }
     if (User::getCurrentUser() != null) {
         $is_manager = User::getCurrentUser()->is_manager;
     } else {
         $is_manager = false;
     }
     //find image path
     $images = HomeImage::where('article_id', '=', $id)->get();
     $comments = CommentsController::show($id);
     return compact('categories', 'category_list', 'article', 'top_list_articles', 'articlesNumber', 'is_manager', 'images', 'comments');
 }