コード例 #1
0
ファイル: PostController.php プロジェクト: jakeboyles/GuyBuy
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create()
 {
     $communitys = Community::all();
     $cities = City::all();
     $categories = Category::all();
     return view('posts.create', ['communitys' => $communitys, 'categories' => $categories, 'cities' => $cities]);
 }
コード例 #2
0
 public function showCityPosts($city, $category)
 {
     $posts = Post::with('author', 'comments.author', 'community')->where('sold', NULL)->where('category_id', $category)->where('city_id', $city)->paginate(12);
     $category = Category::where('id', $category)->get();
     $community = City::where("id", $city)->get();
     $communities = Community::all();
     $city = $community;
     return view('category.home', ['posts' => $posts, 'category' => $category, 'community' => $community, 'city' => $city, 'communities' => $communities]);
 }
コード例 #3
0
ファイル: HomeController.php プロジェクト: jakeboyles/GuyBuy
 /**
  * Show the application dashboard to the user.
  *
  * @return Response
  */
 public function dashboard()
 {
     $user = User::find(Auth::user()->id);
     $communitys = Community::all()->lists('name', 'id');
     $feedbacksGiven = Feedback::where('giver_id', Auth::user()->id)->get();
     $feedbacks = Feedback::where('receiver_id', Auth::user()->id)->get();
     $activePosts = Post::where('user_id', Auth::user()->id)->where('sold', null)->get();
     $offers = Offer::where('post_creator', Auth::user()->id)->whereHas('post', function ($q) {
         $q->where('sold', NULL);
     })->orderBy('created_at', 'desc')->get();
     return view('pages.dashboard', ['user' => $user, 'communities' => $communitys, 'offers' => $offers, 'feedbacks' => $feedbacks, 'activePosts' => $activePosts, 'feedbacksGiven' => $feedbacksGiven]);
 }