Skip to content

Instantly share code, notes, and snippets.

@JeffreyWay
Last active August 18, 2019 00:06
Show Gist options
  • Save JeffreyWay/bd9bdcebda5cfb9f3bab to your computer and use it in GitHub Desktop.
Save JeffreyWay/bd9bdcebda5cfb9f3bab to your computer and use it in GitHub Desktop.
This route will require authentication with a valid api_token, and then return the relevant user, as JSON. - https://laracasts.com/series/whats-new-in-laravel-5-2/episodes/5
<?php
Route::group([
'prefix' => 'api/v1',
'middleware' => ['api', 'auth:api']
], function () {
Route::get('/', function () {
return Auth::guard('api')->user();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment