Exemplo n.º 1
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $task_id = $this->argument('task_id');
     $task = Task::find($task_id);
     $task->is_running = 0;
     $task->save();
     $manager = new TaskManager($task);
     $manager->unlock();
 }
Exemplo n.º 2
0
 public function fire()
 {
     $manager = new TaskManager(Task::findOrFail($this->argument('task_id')));
     if (!$this->option('bg')) {
         //$this->info( 'Running without bg' );
         $manager->run($this);
     } else {
         //$this->info( 'Running in bg' );
         $manager->runInBackground();
     }
 }
Exemplo n.º 3
0
 public function fire()
 {
     $rows = [];
     $tasks = Task::all();
     foreach ($tasks as $task) {
         $tm = new TaskManager($task);
         $rows[] = [$task->id, $task->title, $task->is_running ? '<fg=yellow;options=bold>' . $tm->info->getProgress() . '%</>' : '<fg=magenta>No</>', $task->last_run];
     }
     $table = $this->getHelper('table');
     $this->line('');
     $this->table(array('id', 'title', 'running', 'last run'), $rows);
     $this->line('');
 }
Exemplo n.º 4
0
 public function getAll()
 {
     return Task::all();
 }
Exemplo n.º 5
0
 public function fire()
 {
     $task_id = $this->argument('task_id');
     $cmd = new TaskManager(Task::findOrFail($task_id));
     $cmd->stop();
 }