samedi 5 janvier 2019

Laravel JWT return data from two tables

I am using JWT authentication via api.php

when a user login to the route

Route::post('login', 'AuthController@login'); 

he reached this method in auth controller

protected function respondWithToken($token)
    {

        return response()->json([
            'access_token' => $token,
            'token_type' => 'bearer',
            'expires_in' => auth()->factory()->getTTL() * 1000,
            'user' => auth()->user()
        ]);
    }

Here 'user' => auth()->user() is returning the data from user table, I have another table user_Details in which all user information is saved, I want to fetch details from that table to when some one login,

Help me out please.



from Newest questions tagged laravel-5 - Stack Overflow http://bit.ly/2RwDr8Y
via IFTTT

Aucun commentaire:

Enregistrer un commentaire