PHP code example of gashey / lumen-passport-resource
1. Go to this page and download the library: Download gashey/lumen-passport-resource library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
gashey / lumen-passport-resource example snippets
// Enable Facades
$app->withFacades();
// Enable Eloquent
$app->withEloquent();
// Enable the client middleware and scopes middleware (shipped with Passport)
$app->routeMiddleware([
'client' => \Laravel\Passport\Http\Middleware\CheckClientCredentials::class,
'scopes' => \Laravel\Passport\Http\Middleware\CheckScopes::class,
]);
// Finally register three service providers - original one and Lumen adapter
$app->register(Laravel\Passport\PassportServiceProvider::class);
$app->register(Dusterio\LumenPassport\PassportServiceProvider::class);
$app->register(Gashey\LumenPassportResource\PassportServiceProvider::class);
class User extends Model implements AuthenticatableContract, AuthorizableContract
{
use HasApiTokens, Authenticatable, Authorizable;
/* rest of the model */
}
$router->group(['middleware' => ['client', 'scopes:...'], 'prefix' => 'api/v1'], function () use ($router) {
});
bootstrap/app.php
bash
# Create new tables for Gashey Passport
php artisan migrate
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.