diff --git a/README.md b/README.md index d0c21d7..7af5814 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Add Presenter to your composer.json file: ```js "require": { - "recca0120/terminal": "^1.5.1" + "recca0120/terminal": "^1.6.0" } ``` Now, run a composer update on the command line from the root of your project: @@ -54,11 +54,21 @@ http://localhost/path/to/terminal return [ 'enabled' => true, 'whitelists' => ['127.0.0.1', 'your ip'], - 'router' => [ + 'route' => [ 'prefix' => 'terminal', 'as' => 'terminal.', 'middleware' => ['web'], // if you use laravel 5.1 remove web ], + 'commands' => [ + \Recca0120\Terminal\Console\Commands\Artisan::class, + \Recca0120\Terminal\Console\Commands\ArtisanTinker::class, + \Recca0120\Terminal\Console\Commands\Cleanup::class, + \Recca0120\Terminal\Console\Commands\Find::class, + \Recca0120\Terminal\Console\Commands\Mysql::class, + \Recca0120\Terminal\Console\Commands\Tail::class, + \Recca0120\Terminal\Console\Commands\Vi::class, + // add your command + ], ]; ``` @@ -117,26 +127,6 @@ class Inspire extends Command } ``` -### Add Command -```php -// src/Console/Kernel.php -namespace Recca0120\Terminal\Console; - -use Illuminate\Foundation\Console\Kernel as ConsoleKernel; -use Recca0120\Terminal\Console\Application as Artisan; - -class Kernel extends ConsoleKernel -{ - /** - * The Artisan commands provided by your application. - * - * @var array - */ - protected $commands = [ - Commands\Inspire::class, - ]; -} - ``` ## ScreenShot @@ -164,6 +154,13 @@ $ artisan tinker ``` ![Tinker](https://cdn.rawgit.com/recca0120/terminal/master/screenshots/artisan-tinker.png) +### MySQL +```bash +$ mysql +mysql> select * from users; +``` +![MySQL Command](https://cdn.rawgit.com/recca0120/terminal/master/screenshots/mysql-command.png) + ### Find Command ```bash $ find ./ -name * -maxdepth 1 diff --git a/screenshots/mysql-command.png b/screenshots/mysql-command.png new file mode 100644 index 0000000..4354afa Binary files /dev/null and b/screenshots/mysql-command.png differ diff --git a/src/ServiceProvider.php b/src/ServiceProvider.php index bb6d352..f56900a 100644 --- a/src/ServiceProvider.php +++ b/src/ServiceProvider.php @@ -46,7 +46,7 @@ public function register() $this->mergeConfigFrom(__DIR__.'/../config/terminal.php', 'terminal'); $this->app->singleton(Application::class, function ($app) { $config = $app['config']; - $commands = Arr::get($config, 'terminal.commands'); + $commands = $config->get('terminal.commands'); $artisan = new Application($app, $app['events'], $app->version()); $artisan->resolveCommands($commands); diff --git a/tests/ServiceProviderTest.php b/tests/ServiceProviderTest.php index 726d858..3933d84 100644 --- a/tests/ServiceProviderTest.php +++ b/tests/ServiceProviderTest.php @@ -50,7 +50,8 @@ public function test_boot() ->shouldReceive('get')->with('terminal', [])->twice()->andReturn([ 'whitelists' => ['127.0.0.1'], ]) - ->shouldReceive('set')->with('terminal', m::any())->once(); + ->shouldReceive('set')->with('terminal', m::any())->once() + ->shouldReceive('get')->with('terminal.commands')->once()->andReturn([]); $request ->shouldReceive('getClientIp')->once()->andReturn('127.0.0.1');