Example #1
0
 public function addText()
 {
     $this->_methodName = 'addText';
     $this->resolveParams();
     $this->checkAuth();
     $arNeed = ['userTaskId' => 'required|numeric', 'text' => 'required'];
     $this->checkAttr($arNeed);
     $task_user = \App\UserTask::where('id', $this->_request_params['userTaskId'])->where('id_user', Auth::user()->id)->first();
     if (is_null($task_user)) {
         throw new \App\Exceptions\ExceptionApiContactnotfound($this->_request_params, $this->_typeName, $this->_methodName);
     }
     $infoTask = \App\InfoTask::where('id_taskUser', $task_user->id)->first();
     if (is_null($infoTask)) {
         $infoTask = new \App\InfoTask();
         $infoTask->id_taskUser = $task_user->id;
     }
     $infoTask->text = $this->_request_params['text'];
     $infoTask->save();
     return $this;
 }