rest( FlashSaleResource::collection( FlashSale::query() ->active() ->with(['products' => function ($query) { $query ->with(['brand', 'media', 'reviews']) ->where('products.is_visible', true) ->where('products.parent_id', null) ->where('products.stock', '>', 0); }]) ->latest('starts_at') ->get() ) ); } }