PHP code example of yakovenko / laravel-lighthouse-graphql-multi-schema
1. Go to this page and download the library: Download yakovenko/laravel-lighthouse-graphql-multi-schema 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/ */
yakovenko / laravel-lighthouse-graphql-multi-schema example snippets
// config/lighthouse-multi-schema.php
return [
'multi_schemas' => [
'admin' => [
'route_uri' => '/admin-graphql',
'route_name' => 'admin-graphql',
'schema_path' => base_path('graphql/admin.graphql'),
'schema_cache_path' => base_path('bootstrap/cache/admin-schema.php'),
'schema_cache_enable' => env('LIGHTHOUSE_ADMIN_CACHE_ENABLE', false),
'middleware' => [
\Nuwave\Lighthouse\Http\Middleware\AcceptJson::class,
\Nuwave\Lighthouse\Http\Middleware\AttemptAuthentication::class,
'auth:sanctum',
],
],
'public' => [
'route_uri' => '/graphql',
'route_name' => 'public-graphql',
'schema_path' => base_path('graphql/schema.graphql'),
'schema_cache_path' => base_path('bootstrap/cache/public-schema.php'),
'schema_cache_enable' => env('LIGHTHOUSE_PUBLIC_CACHE_ENABLE', false),
'middleware' => [
\Nuwave\Lighthouse\Http\Middleware\AcceptJson::class,
\Nuwave\Lighthouse\Http\Middleware\AttemptAuthentication::class,
],
],
],
];
->withMiddleware(function (Middleware $middleware) {
$middleware->validateCsrfTokens(except: [
'/admin-graphql',
'/graphql',
]);
})
protected $except = [
'/admin-graphql',
'/graphql',
];
bash
php artisan lighthouse-multi-schema:publish-config
gitignore
schema-directives*.graphql
programmatic-types*.graphql
_lighthouse_ide_helper.php