Fix query to return the user even if userId > 0

This commit is contained in:
Bubka 2020-12-02 23:50:17 +01:00
parent 4d6ae849d8
commit cff545d936

View File

@ -33,9 +33,9 @@ class RegisterController extends Controller
*/ */
public function checkUser() public function checkUser()
{ {
$username = DB::table('users')->where('id', 1)->value('name'); $user = DB::table('users')->first();
return response()->json(['username' => $username], 200); return response()->json(['username' => isset($user->name) ? $user->name : null], 200);
} }
/** /**