dimanche 24 juillet 2016

using orWhere in laravel gives an error

I am unable to use orWhere and I don't know the reason.

My goal is to pull amount_invoice=0 OR total_mileage=0. My query works if I use WHERE clause only. When I add orWhere, then my query fails.

This query works:

$deliveries = $this->instance->delivery
        ->where('amount_invoice', 0);
        //->where('total_mileage', 0);
        //->where('amount_invoice', 0)->where('total_mileage',0);                                
        //->where('amount_invoice', 0)->orWhere('total_mileage', 0);
dd($deliveries);

This query works:

$deliveries = $this->instance->delivery
        //->where('amount_invoice', 0);
        ->where('total_mileage', 0);
        //->where('amount_invoice', 0)->where('total_mileage', 0);
        //->where('amount_invoice', 0)->orWhere('total_mileage', 0);
dd($deliveries);

This query works:

$deliveries = $this->instance->delivery
        //->where('amount_invoice', 0);
        //->where('total_mileage', 0);
        ->where('amount_invoice', 0)->where('total_mileage', 0);
        //->where('amount_invoice', 0)->orWhere('total_mileage', 0);
dd($deliveries);

This query DOES NOT WORK:

$deliveries = $this->instance->delivery
        //->where('amount_invoice', 0);
        //->where('total_mileage', 0);
        //->where('amount_invoice', 0)->where('total_mileage', 0);
        ->where('amount_invoice', 0)->orWhere('total_mileage', 0);
dd($deliveries);

I don't know what is the problem but using orWhere fails



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

Aucun commentaire:

Enregistrer un commentaire