jeudi 11 octobre 2018

Laravel Conditional Clauses When not working for value zero

I have some Conditional Clauses in laravel query,but its not working if the value is zero.It will work if the value is 1 or something

$status    = Input::get('status');
$events    = DB::table('events')
          ->select('events.*')
          ->when($status, function ($query) use ($status) {
           return $query->where("events.status",$status);
           })
          ->get();



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire