This code returns true when run and I don't get it. What am I doing wrong. Thanks guys!
profile = DB::table('profiles')->where('uid', $uid)->first();
echo is_null($profile);
This code returns nothing ie. 0 or false but that shouldn't be the case as the database has a row with that uid.
I'd guess it's the where() clause. The second parameter is actually the comparison operator, not the value to compare against.
Try this:
$profile = DB::table('profiles')->where('uid', '=', $uid)->first();
echo is_null($profile);
$query = DB::getQueryLog();
return Response::json(array(
'error' => true,
'message' => $e->getMessage(),
'trace' => $e->getTrace(),
'sql' => $query
),
200
);
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community