Exemplo n.º 1
0
 /**
  * Check to see if a task detail has been generated already
  * @method doesTheTaskDetailExist
  * @param  [type]                  $task_details [description]
  * @return [type]                                [description]
  */
 private function doesTheTaskDetailExist($task_details)
 {
     $warning = "Task task with name {$task_details['name']} already exists for outage with id {$task_details['outage_id']} ";
     $query = OutageTaskDetail::where('outage_id', $task_details['outage_id'])->where('outage_task_id', $task_details['outage_task_id']);
     switch ($task_details['task_type']) {
         case 'Server Task':
             $query = $query->where('server_id', $task_details['server_id']);
             $warning .= "for server {$task_details['server_id']}";
             break;
         case 'Application Task':
             $query = $query->where('application_id', $task_details['application_id']);
             $warning .= "for application {$task_details['application_id']}";
             break;
         case 'Database Task':
             $query = $query->where('database_id', $task_details['database_id']);
             $warning .= "for database {$task_details['database_id']}";
             break;
     }
     if (!!$query->count()) {
         Log::warning($warning);
         return true;
     }
     return false;
 }
Exemplo n.º 2
0
 /**
  * Clear any task details that have been assigned to this task
  * @method clearTaskDetails
  * @return [type]           [description]
  */
 public function resetTaskDetails()
 {
     OutageTaskDetail::where('outage_id', $this->id)->whereNull('person_id')->where('status', 'New')->delete();
 }