app\FreeProduct::getNextEvents PHP Method

getNextEvents() public static method

public static getNextEvents ( $fields, $limit, $date )
    public static function getNextEvents($fields, $limit, $date)
    {
        $events = self::select($fields)->OfStatus('1')->IsValidIn($date)->with('orders')->orderBy('draw_date')->take($limit)->get();
        return self::getWithProducts($events);
    }

Usage Example

Beispiel #1
0
 public function index()
 {
     $panel = ['center' => ['width' => 10], 'left' => ['width' => 2, 'class' => 'home-no-padding']];
     $helperProd = new productsHelper();
     $carousel = $helperProd->suggest('carousel');
     $viewed = $helperProd->suggest('viewed', 8);
     $categories = $helperProd->suggest('categories');
     $purchased = $helperProd->suggest('purchased');
     $suggestion = ['carousel' => $carousel, 'viewed' => $viewed, 'categories' => $categories, 'purchased' => $purchased];
     $helperProd->resetHaystack();
     //reseting session id validator
     $events = [];
     if (config('app.offering_free_products')) {
         $events = FreeProduct::getNextEvents(['id', 'description', 'min_participants', 'max_participants', 'participation_cost', 'start_date', 'end_date'], 4, date('Y-m-d'));
     }
     $tagsCloud = ProductsController::getTopRated(0, 20, true);
     $allWishes = '';
     $user = \Auth::user();
     if ($user) {
         $allWishes = Order::ofType('wishlist')->where('user_id', $user->id)->where('description', '<>', '')->get();
     }
     $i = 0;
     //carousel implementation
     $jumbotronClasses = ['jumbotron-box-left', 'jumbotron-box-right'];
     //carousel implementation
     $banner = ['/img/banner/01.png', '/img/banner/02.png', '/img/banner/03.png', '/img/banner/04.png'];
     // $this->createTags();
     return view('home', compact('panel', 'suggestion', 'allWishes', 'events', 'tagsCloud', 'jumbotronClasses', 'i', 'banner'));
 }