I have a search function with multiple parameters who seems to not work everytimes on each params for exemple i tested the search query with one param "etat_paiement = 0 ",
normaly i should have no results but i still have one but in the database this record have etat_paiement = 1
where i made a mistake ? thanks a lot in advance
here the code :
$query = EngagementOrder::query();
$filters = [
'structure_engagement_id' => 'structure_id',
'saison_id' => 'saison_id',
'etat_paiement' => 'etat_paiement',
'bl_comptabilite' => 'bl_comptabilite',
];
foreach ($filters as $key => $column) {
$query->when($request->{$key}, function ($query, $value) use ($column) {
$query->where($column, $value);
});
}
$engagements = $query->paginate(10);
in my debug bar i have the query like :
select * from engagement_order
limit 10 offset 0
but i run the search with the url like :
https://mydomaine/engagements?etat_paiement=0
UPDATE : here my select box :
{!! Form::select('etat_paiement', array('1' => 'Facture Réglée' , '0' => 'Facture Non Rélgée') , null , ['class' => 'form-control select2 ', 'placeholder' => 'Selectionnez un type de réglement']) !!}