src/Console/Commands/MakeResource.php
public function handle()
    {
        $resourceParameter = [
            'resource' => $this->argument('resource'),
            'api' => $this->argument('api'),
        ];

        $eloquentParameters = array_merge($resourceParameter, [
            '--eloquent' => $this->option('eloquent'),
            '--no-eloquent' => $this->option('no-eloquent'),
        ]);

        $commands = collect($this->commands);

        /** Just tell the user, if no files are created */
        if ($commands->isEmpty()) {
            $this->info('No files created.');
            return 0;
        }

        /** Filter out any commands the user asked os to. */
        if ($this->option('only') || $this->option('except')) {
            $type = $this->option('only') ? 'only' : 'except';

            $commands = $this->filterCommands($commands, $type);
        }

        /** Run commands that cannot accept Eloquent parameters. */
        $notEloquent = ['make:json-api:validators'];

        if (!$this->runCommandsWithParameters($commands->only($notEloquent), $resourceParameter)) {
            return 1;
        }

        /** Run commands that can accept Eloquent parameters. */
        $eloquent = ['make:json-api:adapter', 'make:json-api:schema'];

        if (!$this->runCommandsWithParameters($commands->only($eloquent), $eloquentParameters)) {
            return 1;
        }

        /** Authorizer */
        if ($this->option('auth')) {
            $this->call('make:json-api:authorizer', [
                'name' => $this->argument('resource'),
                'api' => $this->argument('api'),
                '--resource' => true,
            ]);
        }

        /** Content Negotiator */
        if ($this->option('content-negotiator')) {
            $this->call('make:json-api:content-negotiator', [
                'name' => $this->argument('resource'),
                'api' => $this->argument('api'),
                '--resource' => true,
            ]);
        }

        /** Give the user a digial high-five. */
        $this->comment('All done, keep doing what you do.');

        return 0;
    }
public function handle()
    {
        $resourceParameter = [
            'resource' => $this->argument('resource'),
            'api' => $this->argument('api'),
        ];

        $eloquentParameters = array_merge($resourceParameter, [
            '--eloquent' => $this->option('eloquent'),
            '--no-eloquent' => $this->option('no-eloquent'),
        ]);

        $commands = collect($this->commands);

        /** Just tell the user, if no files are created */
        if ($commands->isEmpty()) {
            $this->info('No files created.');
            return 0;
        }

        /** Filter out any commands the user asked os to. */
        if ($this->option('only') || $this->option('except')) {
            $type = $this->option('only') ? 'only' : 'except';

            $commands = $this->filterCommands($commands, $type);
        }

        /** Run commands that cannot accept Eloquent parameters. */
        $notEloquent = ['make:json-api:validators'];

        if (!$this->runCommandsWithParameters($commands->only($notEloquent), $resourceParameter)) {
            return 1;
        }

        /** Run commands that can accept Eloquent parameters. */
        $eloquent = ['make:json-api:adapter', 'make:json-api:schema'];

        if (!$this->runCommandsWithParameters($commands->only($eloquent), $eloquentParameters)) {
            return 1;
        }

        /** Authorizer */
        if ($this->option('auth')) {
            $this->call('make:json-api:authorizer', [
                'name' => $this->argument('resource'),
                'api' => $this->argument('api'),
                '--resource' => true,
            ]);
        }

        /** Content Negotiator */
        if ($this->option('content-negotiator')) {
            $this->call('make:json-api:content-negotiator', [
                'name' => $this->argument('resource'),
                'api' => $this->argument('api'),
                '--resource' => true,
            ]);
        }

        /** Give the user a digial high-five. */
        $this->comment('All done, keep doing what you do.');

        return 0;
    }
Execute the console command.

@return int