Route middleware auth api get user function Request request return req

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
Route::middleware('auth:api')->get('/user', function (Request $request) {
return $request->user();
});
Route::get('/{id}', function ($id) {
return response()->json([
'name' => 'Abigail',
'state' => 'CA'
]);
});