Esempio n. 1
0
 /**
  * To update task
  *
  * @param $task
  *
  * @return mixed
  */
 public function update($task)
 {
     return Task::whereId($task['id'])->update(['name' => $task['name'], 'description' => $task['description'], 'date' => Carbon::parse($task['date']), 'time' => $task['time']]);
 }
 public function updateSingleTask(Project $project, $id)
 {
     $data = array();
     $data = splitString($id);
     $id = $data[0];
     $statusName = $data[2];
     $currentStatus = $data[3];
     $task = new Task();
     $affectedRows = $task->whereId($id)->orderBy('id', 'desc')->first();
     //dd($affectedRows->task_dev);
     $datetime = currentTimestamp($currentStatus);
     if ($currentStatus == "start" or $currentStatus == "restart") {
         $newStatus = "pause";
     } elseif ($currentStatus == "notStart" or $currentStatus == "end") {
         $newStatus = "start";
     } elseif ($currentStatus == "pause") {
         $newStatus = "restart";
     }
     if ($statusName == "status_des") {
         $task->task_designs = $datetime;
         $task->status_task_designs = $newStatus;
         $task->task_prod = $affectedRows->task_prod;
         $task->status_task_prod = $affectedRows->status_task_prod;
         $task->task_dev = $affectedRows->task_dev;
         $task->status_task_dev = $affectedRows->status_task_dev;
         $task->project_id = $affectedRows->project_id;
         $task->save();
     }
     if ($statusName == "status_dev") {
         $task->task_designs = $affectedRows->task_designs;
         $task->status_task_designs = $affectedRows->status_task_designs;
         $task->task_prod = $affectedRows->task_prod;
         $task->status_task_prod = $affectedRows->status_task_prod;
         $task->task_dev = $datetime;
         $task->status_task_dev = $newStatus;
         $task->project_id = $affectedRows->project_id;
         $task->save();
     }
     if ($statusName == "status_prod") {
         $task->task_designs = $affectedRows->task_designs;
         $task->status_task_designs = $affectedRows->status_task_designs;
         $task->task_prod = $datetime;
         $task->status_task_prod = $newStatus;
         $task->task_dev = $affectedRows->task_dev;
         $task->status_task_dev = $affectedRows->status_task_dev;
         $task->project_id = $affectedRows->project_id;
         $task->save();
     }
     return view('projects.show', compact('project'));
 }