Created
December 11, 2023 06:35
-
-
Save krydos/de408ce2cf59bada9e36bd409703a978 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Providers; | |
use Illuminate\Support\Facades\Blade; | |
use Illuminate\Support\Facades\View; | |
use InfyOm\Generator\Commands\API\APIControllerGeneratorCommand; | |
use InfyOm\Generator\Commands\API\APIGeneratorCommand; | |
use InfyOm\Generator\Commands\API\APIRequestsGeneratorCommand; | |
use InfyOm\Generator\Commands\API\TestsGeneratorCommand; | |
use InfyOm\Generator\Commands\APIScaffoldGeneratorCommand; | |
use InfyOm\Generator\Commands\Common\MigrationGeneratorCommand; | |
use InfyOm\Generator\Commands\Common\ModelGeneratorCommand; | |
use InfyOm\Generator\Commands\Common\RepositoryGeneratorCommand; | |
use InfyOm\Generator\Commands\Publish\GeneratorPublishCommand; | |
use InfyOm\Generator\Commands\Publish\PublishTablesCommand; | |
use InfyOm\Generator\Commands\Publish\PublishUserCommand; | |
use InfyOm\Generator\Commands\RollbackGeneratorCommand; | |
use InfyOm\Generator\Commands\Scaffold\ControllerGeneratorCommand; | |
use InfyOm\Generator\Commands\Scaffold\RequestsGeneratorCommand; | |
use InfyOm\Generator\Commands\Scaffold\ScaffoldGeneratorCommand; | |
use InfyOm\Generator\Commands\Scaffold\ViewsGeneratorCommand; | |
use InfyOm\Generator\Common\FileSystem; | |
use InfyOm\Generator\Common\GeneratorConfig; | |
use InfyOm\Generator\Generators\API\APIControllerGenerator; | |
use InfyOm\Generator\Generators\API\APIRequestGenerator; | |
use InfyOm\Generator\Generators\API\APIRoutesGenerator; | |
use InfyOm\Generator\Generators\API\APITestGenerator; | |
use InfyOm\Generator\Generators\FactoryGenerator; | |
use InfyOm\Generator\Generators\MigrationGenerator; | |
use InfyOm\Generator\Generators\ModelGenerator; | |
use InfyOm\Generator\Generators\RepositoryGenerator; | |
use InfyOm\Generator\Generators\RepositoryTestGenerator; | |
use InfyOm\Generator\Generators\Scaffold\ControllerGenerator; | |
use InfyOm\Generator\Generators\Scaffold\MenuGenerator; | |
use InfyOm\Generator\Generators\Scaffold\RequestGenerator; | |
use InfyOm\Generator\Generators\Scaffold\RoutesGenerator; | |
use InfyOm\Generator\Generators\Scaffold\ViewGenerator; | |
use InfyOm\Generator\Generators\SeederGenerator; | |
use InfyOm\Generator\InfyOmGeneratorServiceProvider as BaseInfyOmGeneratorServiceProvider; | |
class InfyOmGeneratorServiceProvider extends BaseInfyOmGeneratorServiceProvider | |
{ | |
/** | |
* Bootstrap the application services. | |
* | |
* @return void | |
*/ | |
public function boot() | |
{ | |
if ($this->app->runningInConsole()) { | |
$configPath = __DIR__.'/../config/laravel_generator.php'; | |
$this->publishes([ | |
$configPath => config_path('laravel_generator.php'), | |
], 'laravel-generator-config'); | |
$this->publishes([ | |
__DIR__.'/../views' => resource_path('views/vendor/laravel-generator'), | |
], 'laravel-generator-templates'); | |
} | |
$this->registerCommands(); | |
$this->loadViewsFrom(__DIR__.'/../views', 'laravel-generator'); | |
View::composer('laravel-generator::*', function ($view) { | |
$view->with(['config' => app(GeneratorConfig::class)]); | |
}); | |
Blade::directive('tab', function () { | |
return '<?php echo infy_tab() ?>'; | |
}); | |
Blade::directive('tabs', function ($count) { | |
return "<?php echo infy_tabs($count) ?>"; | |
}); | |
Blade::directive('nl', function () { | |
return '<?php echo infy_nl() ?>'; | |
}); | |
Blade::directive('nls', function ($count) { | |
return "<?php echo infy_nls($count) ?>"; | |
}); | |
} | |
// this command is from base class | |
// but since it's private we cannot access it without | |
// copying it from there | |
private function registerCommands() | |
{ | |
if (!$this->app->runningInConsole()) { | |
return; | |
} | |
$this->commands([ | |
APIScaffoldGeneratorCommand::class, | |
APIGeneratorCommand::class, | |
APIControllerGeneratorCommand::class, | |
APIRequestsGeneratorCommand::class, | |
TestsGeneratorCommand::class, | |
MigrationGeneratorCommand::class, | |
ModelGeneratorCommand::class, | |
RepositoryGeneratorCommand::class, | |
GeneratorPublishCommand::class, | |
PublishTablesCommand::class, | |
PublishUserCommand::class, | |
ControllerGeneratorCommand::class, | |
RequestsGeneratorCommand::class, | |
ScaffoldGeneratorCommand::class, | |
ViewsGeneratorCommand::class, | |
RollbackGeneratorCommand::class, | |
]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment