예제 #1
0
 public function getEmailtaskassign($id = false)
 {
     if (!$id) {
         return App::abort(404);
     }
     $assignment = Taskassign::find($id);
     if (!$assignment) {
         return App::abort(404);
     }
     Taskemails::taskAssigned($assignment);
 }
예제 #2
0
 public function postSavereassignment()
 {
     if (!Request::ajax()) {
         return App::abort(404);
     }
     $fields = ["user" => Input::get("user"), "id" => Input::get("id")];
     $rules = ["user" => "required|numeric|exists:users,id", "id" => "required|numeric|exists:tasks,id"];
     $customMessages = ["user.required" => "Вы не выбрали сотрудника"];
     $validator = Validator::make($fields, $rules, $customMessages);
     if ($validator->fails()) {
         $error = "";
         foreach (array_keys($fields) as $k) {
             $message = $validator->messages()->first($k);
             if ($message) {
                 $error .= $message;
             }
         }
         return Response::json(["error" => $error]);
     }
     $task = Task::find(Input::get("id"));
     if (!$task) {
         return App::abort(404);
     }
     $task->deadline_at = $this->makeDeadlineDate();
     $task->save();
     $assign = new Taskassign();
     $assign->task_id = Input::get("id");
     $assign->user_from_id = $this->userdata->id;
     $assign->user_to_id = Input::get("user");
     $assign->save();
     Taskemails::taskAssigned($assign);
     return Response::json(["error" => ""]);
 }