getWithProducts() public static method

Returns all products contained in the orders associated with a freeproduct.
public static getWithProducts ( Illuminate\Database\Eloquent\Collection $items ) : freeproducts
$items Illuminate\Database\Eloquent\Collection
return freeproducts collection of all the products contained in the orders associated with freeproduct, but defined as a property of the model
Beispiel #1
0
 public static function getNextEvents($fields = ['*'], $limit = 5, $date)
 {
     $events = FreeProduct::select($fields)->OfStatus('1')->IsValidIn($date)->with('orders')->orderBy('draw_date')->take($limit)->get();
     return FreeProduct::getWithProducts($events);
 }