2019-01-08 21:42:56 -06:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Providers;
|
|
|
|
|
2019-02-05 16:50:51 -06:00
|
|
|
use App\Console\MigrateInstallCommand;
|
2019-01-08 21:42:56 -06:00
|
|
|
use Illuminate\Foundation\Providers\ArtisanServiceProvider;
|
|
|
|
|
|
|
|
class CliServiceProvider extends ArtisanServiceProvider
|
|
|
|
{
|
|
|
|
public function register()
|
|
|
|
{
|
|
|
|
// Restrict LibreNMS CLI commands
|
|
|
|
if (defined('LIBRENMS_CLI') && $this->app->environment() == 'production') {
|
|
|
|
$this->commands = array_intersect_key($this->commands, [
|
2020-09-21 15:59:34 +02:00
|
|
|
'Migrate' => true,
|
|
|
|
'MigrateInstall' => true,
|
2019-01-08 21:42:56 -06:00
|
|
|
]);
|
|
|
|
|
|
|
|
$this->registerCommands($this->commands);
|
|
|
|
} else {
|
|
|
|
$this->app->register(\Laravel\Tinker\TinkerServiceProvider::class);
|
|
|
|
parent::register();
|
|
|
|
}
|
|
|
|
}
|
2019-01-17 09:00:25 -06:00
|
|
|
|
|
|
|
protected function registerModelMakeCommand()
|
|
|
|
{
|
|
|
|
// override with our own implementation to put models in the correct namespace
|
|
|
|
$this->app->singleton('command.model.make', function ($app) {
|
|
|
|
return new \App\Console\ModelMakeCommand($app['files']);
|
|
|
|
});
|
|
|
|
}
|
2019-02-05 16:50:51 -06:00
|
|
|
|
|
|
|
protected function registerMigrateInstallCommand()
|
|
|
|
{
|
|
|
|
// override so we can hide it
|
|
|
|
$this->app->singleton('command.migrate.install', function ($app) {
|
|
|
|
return new MigrateInstallCommand($app['migration.repository']);
|
|
|
|
});
|
|
|
|
}
|
2019-01-08 21:42:56 -06:00
|
|
|
}
|