Base functionality and helpers used for building for Chief Tools.
Base functionality and helpers used for building Chief Tools.
Keep in mind that this package is not meant to be used standalone, but as a base for building our own Chief Tools, this package is open-sourced for inspiration and to be used as a reference.
/api/graphql/web
/api/playground
/api/graphql
(tokens managed by Account Chief)/contact
, /privacy
, /terms
last_login
column on the users
tableQUEUE_MONITOR_URL
every minute using the default queue (disabled when QUEUE_MONITOR_URL
is empty or unset)ChiefTools\SDK\Middleware\AuthenticateChief
services.chief.webhook_secret
configuration to be set to a random stringChiefTools\SDK\Middleware\AutoAuthenticate
api
and web
guard and sets the first that is authenticatedChiefTools\SDK\Middleware\ForceSecure
https://
ChiefTools\SDK\Middleware\MoveAccessTokenFromURLToHeader
access_token
GET paramater to the Authorization
headerChiefTools\SDK\Middleware\SecurityHeaders
chief.response.securityheaders
(array) in the app configChiefTools\SDK\Middleware\TrustProxiesOnVapor
fideloper/proxy
to be used on Laravel VaporChiefTools\SDK\Rules\UUID
active($whitelist = null, $blacklist = null, $active = 'active', $inactive = '')
timezones(): array
validate($fields, $rules): bool
validate($id, new \ChiefTools\SDK\Rules\UUID)
latest_ca_bundle_file_path(): string
Start with requiring the package:
composer require chieftools/sdk
Publish the configuration files and optionally the migrations:
php artisan vendor:publish --tag=chief-config
# php artisan vendor:publish --tag=chief-migrations
Run the app migrations to create the users table:
php artisan migrate
Add the Chief service to the config/services.php
:
<?php
return [
'chief' => [
'client_id' => env('CHIEF_CLIENT_ID'),
'client_secret' => env('CHIEF_CLIENT_SECRET'),
'webhook_secret' => env('CHIEF_SECRET'),
'base_url' => env('CHIEF_BASE_URL', 'https://account.chief.app'),
'verify' => env('CHIEF_VERIFY', true),
'redirect' => '/login/callback',
],
];
That’s all, you should be able to authenticate against Account Chief.
You will need to create a routes/graphql/schema.graphql
in your own project with the following contents:
#import ../../vendor/chieftools/sdk/routes/graphql/schema.graphql
Anything you want to add the the schema you can do thereafter, for example:
#import ../../vendor/chieftools/sdk/routes/graphql/schema.graphql
#import ./types/*.graphql
#import ./queries/*.graphql
Keep in mind that the User
type is already provided so you will need to extend that if you want to append fields.
type OfType implements Entity {
id: ID!
}
extend type User {
relation: [OfType!]! @hasMany(type: "paginator")
}