mercredi 1 février 2017

How to user whereIn with <=?

Ok i have 6 of checkboxes in view:

<input type="checkbox" name="rooms[]" id="room1" value="1" />1
<input type="checkbox" name="rooms[]" id="room2" value="2" />2
<input type="checkbox" name="rooms[]" id="room3" value="3" />3
<input type="checkbox" name="rooms[]" id="room4" value="4" />4
<input type="checkbox" name="rooms[]" id="room5" value="5" />5
<input type="checkbox" name="rooms[]" id="room6" value="6" />6+

User can check all of them, but i have problem when user check for example first where value is 1 and last one where value is 6+. When user check that i want to get all records where value of room is 1 and value of room >= 6. Any suggestion how can i do that?

I tried this but this not working when user check last one.

  $value = 6;
    if (!in_array($value, $option)) {
          $query->whereIn('rooms',$option
         }
          else{
              $query->where('rooms','>=',$value);
         }



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

Aucun commentaire:

Enregistrer un commentaire