I've a Laravel 5.0 project, that I need to implement the following logic
$var1= 'A';
$var2= 'B';
$var3= 50;
$data = DataModel::select('attr1','attr2')->where(function($q){
$q->where('attr3','like','%'.$var1.'%');
$q->where('attr4','like',$var2.'%');
$q->where('attr5','=',$var3);
})->get();
The problem is for the "Where" function $var1, var2 and $var3 are undefined variables.
My Question is, How can I pass multiple parameters to the where function?
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2fzIV01
via IFTTT
Aucun commentaire:
Enregistrer un commentaire