src/Illuminate/Foundation/Console/ControllerMakeCommand.php
protected function buildResourceReplacements(array $replace)
    {
        $name = $this->getNameInput();
        $rootNamespace = trim(
                $this->laravel->getNamespace() . 'Http\Resources' . '\\' . $this->getNamespace($name),
                '\\'
            );
        $indexResource = $rootNamespace . '\\' . str_replace('Controller', '', class_basename($name)) . 'IndexResource';
        $showResource = $rootNamespace . '\\' . str_replace('Controller', '', class_basename($name)) . 'ShowResource';
        $storeResource = $rootNamespace . '\\' . str_replace('Controller', '', class_basename($name)) . 'StoreResource';
        $updateResource = $rootNamespace . '\\' . str_replace('Controller', '', class_basename($name)) . 'UpdateResource';
        $deleteResource = $rootNamespace . '\\' . str_replace('Controller', '', class_basename($name)) . 'DeleteResource';

        if (! class_exists($indexResource)) {
            if ($this->confirm("A {$indexResource} resource does not exist. Do you want to generate it?", true)) {
                $this->call('make:resource', ['name' => $indexResource, '--collection' => true]);
            }
        }

        if (! class_exists($showResource)) {
            if ($this->confirm("A {$showResource} resource does not exist. Do you want to generate it?", true)) {
                $this->call('make:resource', ['name' => $showResource]);
            }
        }

        if (! class_exists($storeResource)) {
            if ($this->confirm("A {$storeResource} resource does not exist. Do you want to generate it?", true)) {
                $this->call('make:resource', ['name' => $storeResource]);
            }
        }

        if (! class_exists($updateResource)) {
            if ($this->confirm("A {$updateResource} resource does not exist. Do you want to generate it?", true)) {
                $this->call('make:resource', ['name' => $updateResource]);
            }
        }

        if (! class_exists($deleteResource)) {
            if ($this->confirm("A {$deleteResource} resource does not exist. Do you want to generate it?", true)) {
                $this->call('make:resource', ['name' => $deleteResource]);
            }
        }

        return array_merge($replace, [
            'DummyFullIndexResourceClass' => $indexResource,
            'DummyIndexResourceClass' => class_basename($indexResource),
            'DummyFullShowResourceClass' => $showResource,
            'DummyShowResourceClass' => class_basename($showResource),
            'DummyFullStoreResourceClass' => $storeResource,
            'DummyStoreResourceClass' => class_basename($storeResource),
            'DummyFullUpdateResourceClass' => $updateResource,
            'DummyUpdateResourceClass' => class_basename($updateResource),
            'DummyFullDeleteResourceClass' => $deleteResource,
            'DummyDeleteResourceClass' => class_basename($deleteResource),
        ]);
    }
protected function buildResourceReplacements(array $replace)
    {
        $name = $this->getNameInput();
        $rootNamespace = trim(
                $this->laravel->getNamespace() . 'Http\Resources' . '\\' . $this->getNamespace($name),
                '\\'
            );
        $indexResource = $rootNamespace . '\\' . str_replace('Controller', '', class_basename($name)) . 'IndexResource';
        $showResource = $rootNamespace . '\\' . str_replace('Controller', '', class_basename($name)) . 'ShowResource';
        $storeResource = $rootNamespace . '\\' . str_replace('Controller', '', class_basename($name)) . 'StoreResource';
        $updateResource = $rootNamespace . '\\' . str_replace('Controller', '', class_basename($name)) . 'UpdateResource';
        $deleteResource = $rootNamespace . '\\' . str_replace('Controller', '', class_basename($name)) . 'DeleteResource';

        if (! class_exists($indexResource)) {
            if ($this->confirm("A {$indexResource} resource does not exist. Do you want to generate it?", true)) {
                $this->call('make:resource', ['name' => $indexResource, '--collection' => true]);
            }
        }

        if (! class_exists($showResource)) {
            if ($this->confirm("A {$showResource} resource does not exist. Do you want to generate it?", true)) {
                $this->call('make:resource', ['name' => $showResource]);
            }
        }

        if (! class_exists($storeResource)) {
            if ($this->confirm("A {$storeResource} resource does not exist. Do you want to generate it?", true)) {
                $this->call('make:resource', ['name' => $storeResource]);
            }
        }

        if (! class_exists($updateResource)) {
            if ($this->confirm("A {$updateResource} resource does not exist. Do you want to generate it?", true)) {
                $this->call('make:resource', ['name' => $updateResource]);
            }
        }

        if (! class_exists($deleteResource)) {
            if ($this->confirm("A {$deleteResource} resource does not exist. Do you want to generate it?", true)) {
                $this->call('make:resource', ['name' => $deleteResource]);
            }
        }

        return array_merge($replace, [
            'DummyFullIndexResourceClass' => $indexResource,
            'DummyIndexResourceClass' => class_basename($indexResource),
            'DummyFullShowResourceClass' => $showResource,
            'DummyShowResourceClass' => class_basename($showResource),
            'DummyFullStoreResourceClass' => $storeResource,
            'DummyStoreResourceClass' => class_basename($storeResource),
            'DummyFullUpdateResourceClass' => $updateResource,
            'DummyUpdateResourceClass' => class_basename($updateResource),
            'DummyFullDeleteResourceClass' => $deleteResource,
            'DummyDeleteResourceClass' => class_basename($deleteResource),
        ]);
    }
protected function buildResourceReplacements ( array $ replace ) { $ name = $ this -> getNameInput ( ) ; $ rootNamespace = trim ( $ this -> laravel -> getNamespace ( ) . 'Http\Resources' . '\\' . $ this -> getNamespace ( $ name ) , '\\' ) ; $ indexResource = $ rootNamespace . '\\' . str_replace ( 'Controller' , '' , class_basename ( $ name ) ) . 'IndexResource' ; $ showResource = $ rootNamespace . '\\' . str_replace ( 'Controller' , '' , class_basename ( $ name ) ) . 'ShowResource' ; $ storeResource = $ rootNamespace . '\\' . str_replace ( 'Controller' , '' , class_basename ( $ name ) ) . 'StoreResource' ; $ updateResource = $ rootNamespace . '\\' . str_replace ( 'Controller' , '' , class_basename ( $ name ) ) . 'UpdateResource' ; $ deleteResource = $ rootNamespace . '\\' . str_replace ( 'Controller' , '' , class_basename ( $ name ) ) . 'DeleteResource' ; if ( ! class_exists ( $ indexResource ) ) { if ( $ this -> confirm ( "A {$indexResource} resource does not exist. Do you want to generate it?" , true ) ) { $ this -> call ( 'make:resource' , [ 'name' => $ indexResource , '--collection' => true ] ) ; } } if ( ! class_exists ( $ showResource ) ) { if ( $ this -> confirm ( "A {$showResource} resource does not exist. Do you want to generate it?" , true ) ) { $ this -> call ( 'make:resource' , [ 'name' => $ showResource ] ) ; } } if ( ! class_exists ( $ storeResource ) ) { if ( $ this -> confirm ( "A {$storeResource} resource does not exist. Do you want to generate it?" , true ) ) { $ this -> call ( 'make:resource' , [ 'name' => $ storeResource ] ) ; } } if ( ! class_exists ( $ updateResource ) ) { if ( $ this -> confirm ( "A {$updateResource} resource does not exist. Do you want to generate it?" , true ) ) { $ this -> call ( 'make:resource' , [ 'name' => $ updateResource ] ) ; } } if ( ! class_exists ( $ deleteResource ) ) { if ( $ this -> confirm ( "A {$deleteResource} resource does not exist. Do you want to generate it?" , true ) ) { $ this -> call ( 'make:resource' , [ 'name' => $ deleteResource ] ) ; } } return array_merge ( $ replace , [ 'DummyFullIndexResourceClass' => $ indexResource , 'DummyIndexResourceClass' => class_basename ( $ indexResource ) , 'DummyFullShowResourceClass' => $ showResource , 'DummyShowResourceClass' => class_basename ( $ showResource ) , 'DummyFullStoreResourceClass' => $ storeResource , 'DummyStoreResourceClass' => class_basename ( $ storeResource ) , 'DummyFullUpdateResourceClass' => $ updateResource , 'DummyUpdateResourceClass' => class_basename ( $ updateResource ) , 'DummyFullDeleteResourceClass' => $ deleteResource , 'DummyDeleteResourceClass' => class_basename ( $ deleteResource ) , ] ) ; }
Build the resource replacement values.

@param  array  $replace
@return array
Build the resource replacement values .