Nasr1

getting user registeration info when login , in postman

Posted 1 year ago by Nasr1

this is my code for login action method :

public function login(LoginRequest $request, JWTAuth $JWTAuth) { $credentials = $request->only(['email', 'password']);

    try {
        $token = $JWTAuth->attempt($credentials);

        if(!$token) {
            throw new AccessDeniedHttpException();
        }

    } catch (JWTException $e) {
        throw new HttpException(500);
    }
    $user = new User($request->all());
    return response()
        ->json([
            'status' => 'ok',
            'token' => $token            ]);

what should i do to make it back not only the token but also all the info of the user registered like its username password email etc , thk guys

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

Reply to

Use Markdown with GitHub-flavored code blocks.