title: laravel how to make a multiple filter using query in datatables using switch
body: <p>i have 5 filter , kampus,fakulti,program ,semester and status
  so each filter is always been filter with status
  it means the status filter will be the selection of switch case and the other filter will be condition in the switch case example :</p>
  <pre><code>$student = Student::select(&quot;*&quot;);
  
      if($student){
        $today = date(&quot;Y-m-d&quot;);
        switch($request-&gt;stat){
          case 'Y':
            
            if($request-&gt;kampus != &quot;-&quot; &amp;&amp; $request-&gt;fakulti != &quot;-&quot; &amp;&amp; $request-&gt;program != &quot;-&quot; &amp;&amp; $request-&gt;part != &quot;-&quot; ){
              $rs = $student-&gt;where('kodkampus',$request-&gt;kampus)
              -&gt;where('kodfakulti',$request-&gt;fakulti)
              -&gt;where('kodprogram',$request-&gt;program)
              -&gt;where('part',$request-&gt;semester)
              -&gt;where('vaccine_date', '&lt;=', $today)
              -&gt;where('vaccine2_date', '&lt;=', $today);
  
            } else if ($request-&gt;kampus != &quot;-&quot; &amp;&amp; $request-&gt;fakulti != &quot;-&quot;  &amp;&amp; $request-&gt;program != &quot;-&quot; ){
              
              $rs = $student
              -&gt;where('kodkampus',$request-&gt;kampus)
              -&gt;where('kodprogram',$request-&gt;program)
              -&gt;where('kodfakulti',$request-&gt;fakulti)
  
              -&gt;where('vaccine_date', '&lt;=', $today)
              -&gt;where('vaccine2_date', '&lt;=', $today);
  
            } else if ($request-&gt;kampus != &quot;-&quot; &amp;&amp; $request-&gt;fakulti != &quot;-&quot;){
              $rs = $student-&gt;where('kodkampus',$request-&gt;kampus)
              -&gt;where('kodfakulti',$request-&gt;fakulti)
              -&gt;where('vaccine_date', '&lt;=', $today)
              -&gt;where('vaccine2_date', '&lt;=', $today);
              
            } else if ($request-&gt;kampus != &quot;-&quot;){
              $rs = $student-&gt;where('kodkampus',$request-&gt;kampus)
              -&gt;where('vaccine_date', '&lt;=', $today)
              -&gt;where('vaccine2_date', '&lt;=', $today);
            }
  
            
            $rs = $rs-&gt;get();
            break;
          case 'D1':
            $rs = Student::get();
             break;
        }
  
        return datatables()
        -&gt;of($rs)-&gt;make(true);
  
      }else{
        abort(404,'no record');
      }
  </code></pre>
  <p>so i need that the filter can filter individually without need to fulfill all the condition, for example if i want to filter only fakulti, i can without choosing kampus and program and semester. im seriusly need help and i need it to be individual filter but in the same query</p>
  <p>please2 help me im stuck about 3 days, and i'm a new to laravel, using eloquent and datatable</p>