/** * @param null $bar * @return bool */ public function process($bar = null) { Log::info('Start process'); $tasks = $this->taskRepository->getPending(); if (!$tasks->count()) { return true; } if ($bar !== null) { $bar->start($tasks->count() + 1); } $this->login(); $this->advanceBar($bar); foreach ($tasks as $task) { try { $this->processTask($task); $this->tasksProcesseds[] = $task; } catch (\Exception $e) { $task->status = 'ERROR'; $task->error_message = $e->getMessage(); $task->save(); } $this->advanceBar($bar); } Log::info('Finish process'); return true; }
public function removeAction(Request $request, $id) { $task = $this->repository->findById($id); if (!$task) { $request->session()->flash('message', "Task [{$id}] not found"); return redirect('tasks'); } $taskDescription = $task->task; Tasks::destroy($id); $request->session()->flash('message', "Successfully removed task [{$taskDescription}]"); $request->session()->flash('success', true); return redirect('tasks'); }