API module for OctoberCMS
- Copy module to {project root}/modules/api
- Run command
composer updatein project root - Add
apitocms.loadModulesconfiguration - Run command
php artisan vendor:publish --provider="Api\ServiceProvider"in project root
You can use the schema located at {project root}/graphql/schema.graphql.
- Add the following function to your Plugin.php file.
public function registerGraphQLModels()
{
return [
'RainLab\User\Models\User',
];
} - Create /plugins/user/models/user/schema.graphql
Schemas created for a model inside of a plugin should always use
extend type Queryto define a query.
The modules comes with the GraphQL playground. Go to /graphql-playground in your browser and test your schema here.