PHP code example of brausepulver / laravel-eloquent-to-graphql

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

    

brausepulver / laravel-eloquent-to-graphql example snippets


use Illuminate\Database\Eloquent\Relations\HasMany;

class User extends Model
{
    public function cuteCats(): HasMany
    {
        ...
    }
}

    'custom_type_mappings' => [
        'from-type' => 'to-type'
    ]

php artisan e2gql
json
    "emeraldwalk.runonsave": {
        "commands": [
            {
                "match": "app/Models/.*\\.php",
                "isAsync": true,
                "cmd": "php artisan e2gql --force"
            }
        ]
    }