File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1010
1111use App \Http \Controllers \Controller ;
1212use Illuminate \Http \Request ;
13+ use Illuminate \Support \Facades \Auth ;
1314use Tymon \JWTAuth \JWTAuth ;
1415class AuthController extends Controller
1516{
@@ -50,6 +51,12 @@ public function postLogin(Request $request)
5051
5152 }
5253
53- return response ()->json (compact ('token ' ));
54+
55+
56+ // return response()->json(compact('token'));
57+
58+ $ response = compact ('token ' );
59+ $ response ['user ' ] = Auth::user ();
60+ return response ()->json ($ response );
5461 }
5562}
Original file line number Diff line number Diff line change 6565// ]);
6666
6767 $ app ->routeMiddleware ([
68- // 'auth' => App\Http\Middleware\Authenticate::class,
69- 'jwt-auth ' => \Tymon \JWTAuth \Http \Middleware \Authenticate::class,
68+ 'auth ' => App \Http \Middleware \Authenticate::class,
69+ // 'jwt-auth' => \Tymon\JWTAuth\Http\Middleware\Authenticate::class,
7070 ]);
7171
7272/*
Original file line number Diff line number Diff line change 1717
1818$ router ->post ('/auth/login ' , 'AuthController@postLogin ' );
1919
20- $ router ->group (['middleware ' => 'jwt-auth ' ], function () use ($ router )
20+ //$router->group(['middleware' => 'jwt-auth'], function() use ($router)
21+ $ router ->group (['middleware ' => 'auth:api ' ], function () use ($ router )
2122{
2223 $ router ->get ('/test ' , function () {
2324 return response ()->json ([
You can’t perform that action at this time.
0 commit comments