Skip to content

Commit

Permalink
feat: move user api closure to controller to allow usage of `php arti…
Browse files Browse the repository at this point in the history
…san route:cache`
  • Loading branch information
quentincaffeino committed Sep 24, 2021
1 parent 44c8430 commit 4d0f9e2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
19 changes: 19 additions & 0 deletions app/Http/Controllers/API/UserApiController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace App\Http\Controllers\API;

use Illuminate\Http\Request;

class UserApiController extends ApiBaseController
{

/**
* @param Request $request
* @return mixed
*/
public function get(Request $request)
{
return $request->user();
}

}
4 changes: 1 addition & 3 deletions routes/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
|
*/

Route::middleware('auth:api')->get('/user', function (Request $request) {
return $request->user();
});
Route::middleware('auth:api')->get('/user', [API\UserApiController::class, 'get']);

/*
* ---------------
Expand Down

0 comments on commit 4d0f9e2

Please sign in to comment.