samedi 24 juin 2017

conditional mongodb moloquent query in laravel

I'm trying to make a dynamic query which it will extend if some conditions are true, but as much as tried I got error messages.

Is there any way to implement this query login using laravel (jessenger) moloquent query maker :

The Example I created :

Bcamp::whereIn("targets.cats", $seat_category_list)
->whereIn('targets.os', $os)
->orWhere('target.os', 'all')
->where('banners.' . $banner_size, 'exists', true)
->where('targets.gold_network', $gold_network)
->whereNotIn('status', $status)
->where('daily_budget_status', '<>', Bcamp::STATUS_LOW_BUDGET)
->Where(function ($query) use ($seat_filter_list) {
     if($seat_filter_list) {
        $query->whereNotIn('href', $seat_filter_list);
     }
 })
->Where(function ($query) use ($city, $country) {
    if($country) {
        $query->whereIn('targets.region', $country)
              ->orWhereIn('targets.region', $city);
    }
})
->get();



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2t5LTjl
via IFTTT

Aucun commentaire:

Enregistrer un commentaire