Ejemplo n.º 1
0
 /**
  * Display the specified category.
  *
  * @param  int $id
  * @return Response
  */
 public function show($alias, Advertisement $advertisement)
 {
     $category = Category::where('alias', $alias)->first();
     $ads = $advertisement->approved()->where('category_id', $category->id)->orderBy('id', 'desc')->paginate(3);
     return view('welcome', ['ads' => $ads]);
     //->nest('child','task.index');
 }
Ejemplo n.º 2
0
 public function index(Advertisement $advertisement, Request $request)
 {
     $ads = $advertisement->approved()->orderBy('top', 'desc')->orderBy('id', 'desc');
     if ($_SERVER['HTTP_HOST'] == env('HOST')) {
         $ads = $ads->paginate(10);
     } else {
         $ads = $ads->paginate(20);
     }
     return view('welcome', compact('ads'));
 }