2 years ago

getting user registeration info when login , in postman

Posted 2 years 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()
            '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.