<?php return ['standardsTree' => env('API_STANDARDS_TREE', 'x'), 'subtype' => env('API_SUBTYPE', ''), 'version' => env('API_VERSION', 'v1'), 'prefix' => env('API_PREFIX', null), 'domain' => env('API_DOMAIN', 'www.laravel.com'), 'name' => env('API_NAME', null), 'conditionalRequest' => env('API_CONDITIONAL_REQUEST', true), 'strict' => env('API_STRICT', false), 'debug' => env('API_DEBUG', false), 'errorFormat' => ['message' => ':message', 'errors' => ':errors', 'code' => ':code', 'status_code' => ':status_code', 'debug' => ':debug'], 'oauth' => function ($app) { $provider = new Dingo\Api\Auth\Provider\OAuth2($app['oauth2-server.authorizer']->getChecker()); $provider->setUserResolver(function ($id) { return User::findOrFail($id); // Logic to return a user by their ID. }); $provider->setClientResolver(function ($id) { // Logic to return a client by their ID. }); return $provider; }, 'throttling' => [], 'transformer' => env('API_TRANSFORMER', 'Dingo\\Api\\Transformer\\Adapter\\Fractal'), 'defaultFormat' => env('API_DEFAULT_FORMAT', 'json'), 'formats' => ['json' => 'Dingo\\Api\\Http\\Response\\Format\\Json']];
$fractal = new League\Fractal\Manager(); $fractal->setSerializer(new League\Fractal\Serializer\JsonApiSerializer()); return new Dingo\Api\Transformer\Adapter\Fractal($fractal); }); // Dingo basic auth $app['Dingo\\Api\\Auth\\Auth']->extend('basic', function ($app) { return new Dingo\Api\Auth\Provider\Basic($app['auth'], 'phone'); }); // Dingo OAuth2.0 auth $app['Dingo\\Api\\Auth\\Auth']->extend('oauth', function ($app) { $provider = new Dingo\Api\Auth\Provider\OAuth2($app['oauth2-server.authorizer']->getChecker()); $provider->setUserResolver(function ($id) { return App\User::findOrFail($id); }); $provider->setClientResolver(function ($id) { // TODO // return OAuthClient::findOrFail($id); }); return $provider; }); // JWT OAuth app('Dingo\\Api\\Auth\\Auth')->extend('jwt', function ($app) { return new Dingo\Api\Auth\Provider\JWT($app['Tymon\\JWTAuth\\JWTAuth']); }); // Dingo Error Format $app['Dingo\\Api\\Exception\\Handler']->setErrorFormat(['error' => ['message' => ':message', 'errors' => ':errors', 'code' => ':code', 'status_code' => ':status_code', 'debug' => ':debug']]); /* |-------------------------------------------------------------------------- | Load The Application Routes |-------------------------------------------------------------------------- | | Next we will include the routes file so that they can all be added to