Reputation: 5
Here is my Raw query
$searchData=DB::select('SELECT * FROM hostretreats WHERE (furnishing_type= "'.$typesearchkeyword.'" OR prop_type="'.$typesearchkeyword.'") AND approved = 1');
Help me how can I fix it?
Upvotes: 0
Views: 62
Reputation: 2683
You should rewrite select query with DB methods.
$searchData = DB::table('hostretreats')
->where(function($query) use ($typesearchkeyword){
$query
->where('furnishing_type', $typesearchkeyword)
->orWhere('prop_type', $typesearchkeyword);
})
->where('approved', 1)
->paginate(10);
Upvotes: 1