Implemented method to get info on the current user of the API (#5722)

* Implemented method to get info on the current user of the API

* Move userinfo method to UsersController

* Added missing files
This commit is contained in:
Juan Font 2018-07-03 05:35:10 +02:00 committed by snipe
parent 8732f299e6
commit 311f9fcefb
2 changed files with 22 additions and 2 deletions

View file

@ -320,4 +320,17 @@ class UsersController extends Controller
return response()->json(['message' => 'No ID provided'], 500); return response()->json(['message' => 'No ID provided'], 500);
} }
/**
* Get info on the current user.
*
* @author [Juan Font] [<juanfontalonso@gmail.com>]
* @since [v4.4.2]
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function getCurrentUserInfo(Request $request)
{
return response()->json($request->user());
}
} }

View file

@ -674,8 +674,8 @@ Route::group(['prefix' => 'v1','namespace' => 'Api'], function () {
/*--- Users API ---*/
/*--- Users API ---*/
Route::group([ 'prefix' => 'users' ], function () { Route::group([ 'prefix' => 'users' ], function () {
@ -687,6 +687,13 @@ Route::group(['prefix' => 'v1','namespace' => 'Api'], function () {
] ]
); );
Route::get('me',
[
'as' => 'api.users.me',
'uses' => 'UsersController@getCurrentUserInfo'
]
);
Route::get('list/{status?}', Route::get('list/{status?}',
[ [
'as' => 'api.users.list', 'as' => 'api.users.list',