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


return [
    'multi_schemas' => [
        'schema1' => [
            'route_uri'           => '/schema1-graphql',
            'route_name'          => 'schema1-graphql',
            'schema_path'         => base_path("graphql/schema1.graphql"),
            'schema_cache_path'   => env('LIGHTHOUSE_EXAMPLE_SCHEMA_CACHE_PATH', base_path("bootstrap/cache/schema1-schema.php")),
            'schema_cache_enable' => env('LIGHTHOUSE_EXAMPLE_CACHE_ENABLE', false),
        ],
        // Add additional schemas as needed
    ],
];



namespace App\Http\Middleware;

use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;

class VerifyCsrfToken extends Middleware
{
    /**
     * The URIs that should be excluded from CSRF verification.
     *
     * @var array<int, string>
     */
    protected $except = [
        'schema1-graphql',
        'schema2-graphql',
        // Add other routes as needed
    ];
}

'providers' => [
    // Other providers...
    Yakovenko\LighthouseGraphqlMultiSchema\LighthouseMultiSchemaServiceProvider::class,
],
bash
php artisan lighthouse-multi-schema:publish-config
config/app.php

php artisan lighthouse:clear-cache

php artisan lighthouse:clear-cache {keyYourSchema}

php artisan lighthouse:clear-cache schema1