Exemplo n.º 1
0
 /**
  * Test offers pagination.
  */
 public function test_it_paginate_offers()
 {
     // Generate three offers
     factory(App\Offer::class, 3)->create();
     // Generate paginate instance
     $offers = Offer::paginate();
     $this->assertEquals($offers->count(), 3);
 }
Exemplo n.º 2
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     if (Cache::has('offer-data')) {
         $data = Cache::get('offer-data');
         return view('account.offers.list', $data);
     }
     $offers = Offer::paginate(6);
     $data = ['offers' => $offers];
     $expiresAt = Carbon::now()->addMinutes(5);
     Cache::put('offer-data', $data, $expiresAt);
     return view('account.offers.list', $data);
 }