mardi 23 mai 2017

Laravel 5.1 how to make my eloquent query closure secured

what i'm trying to do is to Sum the total deposits of each reservation model, with the condition of less than the amount input in the text.

here's my query:

$reservations->whereHas('deposits', function($query) use ($etc_filters){
                $query->havingRaw('SUM(amount) <= '.$etc_filters);
            });

as you can see, i'm using havingRaw that can be injected with another query. right now i cant find any alternative solution for my code.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire