php - how to search string including with wildcart string -
i'm developing laravel api.i have problem string matching.. have match 2 database column values in same db table
eg: users table, sessionid , userid
my sessionid this,(with % wildcard string)
adfdfvcfgfgfgfgfgbcd.%3d%f
userid this,
0001
when implement code matching string rerun null value.
but sessionid not containing wildcard string , return correct details
this usercontroller.php class show function
public function show($id,$userid) { try{ $user=db::table('users')->where('sessionid',$id) ->where('userid',$userid) ->get(); if(!$user) { return response()->json(['null'],404); } return $user; } catch (exception $exception) { return response('something bad',500); } }
and routes.php class api url
$api->version('v1',function ($api){ $api->get('one/{id}/{userid}',[ 'as'=>'user', 'uses'=> '\app\http\controllers\usercontroller@shower']);});
data store function
public function store(request $request) { $user=new user; $user->sessionid=$request->input('sessionid'); $user->userid = $request->input('userid'); if($user->save()) { return $user; } throw new httpexception(400,"invalid data"); }
Comments
Post a Comment