mardi 14 février 2017

Laravel 5 mysql query ->when condition

My query looks like this at the moment, it should work.

$status = 'active';

$data = DB::table('applicant')
->when($status, function($query) use ($status){
return $query->where('Status', $status);
->get();

But i am getting this error :

Call to undefined method Illuminate\Database\Query\Builder::when()



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

Aucun commentaire:

Enregistrer un commentaire