1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
- namespace App\Console\Commands;
- use Illuminate\Console\Command;
- use Nerd\CartesianProduct\CartesianProduct;
- class TestCommand extends Command
- {
- /**
- * The name and signature of the console command.
- *
- * @var string
- */
- protected $signature = 'test {cmd?}';
- /**
- * The console command description.
- *
- * @var string
- */
- protected $description = 'Command description';
- public function handle()
- {
- $cmd = $this->argument('cmd');
- $args = $this->arguments();
- unset($args['command'], $args['cmd']);
- $params = array_values($args);
- if (empty($cmd)) {
- echo 'Nothing to do...';
- } else {
- if (method_exists($this, $cmd)) {
- call_user_func_array([$this, $cmd], $params);
- } else {
- echo 'cmd not exists';
- }
- }
- return;
- }
- public function time()
- {
- dump(date('Y-m-d H:i:s'));
- }
- }
|