3 years ago

Laravel where clause help

Posted 3 years ago by dilfdo

i wnat to perform search function with laravel for following scenario,

user can select 4 types , each type can contain value 1,2,3

if user select '1' as value for any type , On sql where clause i want to put "==", all the other values i want to put where clause with ">="

if user enters valuse $type1 = 2 , $type2 = 1 , $type3 = 1, $type4 = 3

$type1 = $request->type1;
$type2 = $request->type2;
$type3 = $request->type3;
$type4 = $request->type4;

$min = '=';
$max = '>=';

how can i make my sql query in following way according to the values enter... pls advice

$fod = FodMap::select('*')


Please sign in or create an account to participate in this conversation.