Вход Регистрация
Файл: src/vendor/way/generators/src/Way/Generators/GeneratorsServiceProvider.php
Строк: 230
<?php namespace WayGenerators;

use 
IlluminateSupportServiceProvider;
use 
WayGeneratorsCommandsControllerGeneratorCommand;
use 
WayGeneratorsCommandsModelGeneratorCommand;
use 
WayGeneratorsCommandsResourceGeneratorCommand;
use 
WayGeneratorsCommandsSeederGeneratorCommand;
use 
WayGeneratorsCommandsPublishTemplatesCommand;
use 
WayGeneratorsCommandsScaffoldGeneratorCommand;
use 
WayGeneratorsCommandsViewGeneratorCommand;
use 
WayGeneratorsCommandsPivotGeneratorCommand;

class 
GeneratorsServiceProvider extends ServiceProvider {

    
/**
     * Indicates if loading of the provider is deferred.
     *
     * @var bool
     */
    
protected $defer false;


    
/**
     * Booting
     */
    
public function boot()
    {
        
// If you need to override the default config, copy config/config.php to /config/generators.config.php and update
        
$this->publishes([
            
__DIR__.'/../config/config.php' => config_path('generators.config.php'),
        ]);
    }

    
/**
     * Register the commands
     *
     * @return void
     */
    
public function register()
    {
        foreach([
            
'Model',
            
'View',
            
'Controller',
            
'Migration',
            
'Seeder',
            
'Pivot',
            
'Resource',
            
'Scaffold',
            
'Publisher'] as $command)
        {
            
$this->{"register$command"}();
        }

        
$this->registerConfig();
    }

    
/**
     * Register the model generator
     */
    
protected function registerModel()
    {
        
$this->app['generate.model'] = $this->app->share(function($app)
        {
            
$generator $this->app->make('WayGeneratorsGenerator');

            return new 
ModelGeneratorCommand($generator);
        });

        
$this->commands('generate.model');
    }

    
/**
     * Register the config paths
     */
    
public function registerConfig()
    {
        
$userConfigFile    $this->app->configPath().'/generators.config.php';
        
$packageConfigFile __DIR__.'/../../config/config.php';
        
$config            $this->app['files']->getRequire($packageConfigFile);

        if (
file_exists($userConfigFile)) {
            
$userConfig $this->app['files']->getRequire($userConfigFile);
            
$config     array_replace_recursive($config$userConfig);
        }

        
$this->app['config']->set('generators.config'$config);
    }

    
/**
     * Register the view generator
     */
    
protected function registerView()
    {
        
$this->app['generate.view'] = $this->app->share(function($app)
        {
            
$generator $this->app->make('WayGeneratorsGenerator');

            return new 
ViewGeneratorCommand($generator);
        });

        
$this->commands('generate.view');
    }

    
/**
     * Register the controller generator
     */
    
protected function registerController()
    {
        
$this->app['generate.controller'] = $this->app->share(function($app)
        {
            
$generator $this->app->make('WayGeneratorsGenerator');

            return new 
ControllerGeneratorCommand($generator);
        });

        
$this->commands('generate.controller');
    }

    
/**
     * Register the migration generator
     */
    
protected function registerMigration()
    {
        
$this->app['generate.migration'] = $this->app->share(function($app)
        {
            return 
$this->app->make('WayGeneratorsCommandsMigrationGeneratorCommand');
        });

        
$this->commands('generate.migration');
    }

    
/**
     * Register the seeder generator
     */
    
protected function registerSeeder()
    {
        
$this->app['generate.seeder'] = $this->app->share(function($app)
        {
            
$generator $this->app->make('WayGeneratorsGenerator');

            return new 
SeederGeneratorCommand($generator);
        });

        
$this->commands('generate.seeder');
    }

    
/**
     * Register the pivot generator
     */
    
protected function registerPivot()
    {
        
$this->app['generate.pivot'] = $this->app->share(function($app)
        {
            return new 
PivotGeneratorCommand;
        });

        
$this->commands('generate.pivot');
    }

    
/**
     * Register the resource generator
     */
    
protected function registerResource()
    {
        
$this->app['generate.resource'] = $this->app->share(function($app)
        {
            
$generator $this->app->make('WayGeneratorsGenerator');

            return new 
ResourceGeneratorCommand($generator);
        });

        
$this->commands('generate.resource');
    }

    
/**
     * register command for publish templates
     */
    
public function registerpublisher()
    {
        
$this->app['generate.publish-templates'] = $this->app->share(function($app)
        {
            return new 
publishtemplatescommand;
        });

        
$this->commands('generate.publish-templates');
    }

    
/**
     * register scaffold command
     */
    
public function registerScaffold()
    {
        
$this->app['generate.scaffold'] = $this->app->share(function($app)
        {
            return new 
ScaffoldGeneratorCommand;
        });

        
$this->commands('generate.scaffold');
    }



    
/**
     * Get the services provided by the provider.
     *
     * @return array
     */
    
public function provides()
    {
        return array();
    }

}
Онлайн: 0
Реклама