PHP code example of always-open / laravel-graphql-schema-generator

1. Go to this page and download the library: Download always-open/laravel-graphql-schema-generator 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/ */

    

always-open / laravel-graphql-schema-generator example snippets


return [
    'custom_type_mappings' => [
         'timestamp' => 'DateTime',
         'datetime'  => 'DateTime',
         'date'      => 'Date',
    ],

    'custom_scalar_definitions' => [
        'scalar Date @scalar(class: "Nuwave\\Lighthouse\\Schema\\Types\\Scalars\\Date")',
        'scalar DateTime @scalar(class: "Nuwave\\Lighthouse\\Schema\\Types\\Scalars\\DateTime")',
    ],

    'model_path' => app_path('Models'),

    'model_stub' => __DIR__ . '/../stubs/graphql_schema.stub',

    'schema_path' => app_path('../graphql'),
];
bash
php artisan vendor:publish --tag="laravel-graphql-schema-generator-config"
bash
php artisan laravel-graphql-generator:create-schema
bash
php artisan laravel-graphql-generator:create-schema --additional-models="\\Spatie\\Tags\\Tag"
bash
php artisan laravel-graphql-generator:create-schema --additional-models="\\Spatie\\Tags\\Tag","\\Spatie\\Activitylog\\Models\\Activity"