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 | |
리턴 | freeproducts | collection of all the products contained in the orders associated with freeproduct, but defined as a property of the model |
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); }