public function update(Request $request, $task_id)
 {
     $task = TicketTask::whereId($task_id)->firstOrFail();
     $due_at = $request->input('due_at');
     $completed_at = $request->input('completed_at');
     $completed_by_email = $request->input('completed_by_email');
     // title
     if ($request->has('title')) {
         $task->title = $request->input('title');
     }
     // due_at provided
     if ($due_at !== null && strlen($due_at)) {
         $task->due_at = Carbon::createFromFormat(Carbon::ISO8601, $due_at);
     }
     // completed_at provided
     if ($completed_at !== null && strlen($completed_at)) {
         $task->completed_at = Carbon::createFromFormat(Carbon::ISO8601, $completed_at);
     }
     // completed_at is not empty
     if ($completed_by_email !== null && strlen($completed_by_email)) {
         $staffer = Staff::where('email', '=', $request->input('completed_by_email'))->first();
         $task->completed_by = $staffer ? $staffer->id : null;
     }
     // completed_at provided, but empty indicating it should be cleared
     if ($completed_at === '') {
         $task->completed_at = null;
         $task->completed_by = null;
     }
     $task->save();
     // TODO: What should the response be?
     return '';
 }
 public function update(Request $request, $requirement_id)
 {
     $requirement = TicketRequirement::whereId($requirement_id)->first();
     $staffer = Staff::where('email', '=', $request->input('created_by_email'))->first();
     // Create an archive
     TicketRequirement::create(['parent_id' => $requirement->id, 'zendesk_ticket_id' => $requirement->zendesk_ticket_id, 'title' => $requirement->title, 'body' => $requirement->body, 'sort' => $requirement->sort, 'created_by' => $requirement->created_by])->delete();
     // Update
     $requirement->title = $request->input('title', $requirement->title);
     $requirement->body = $request->input('body', $requirement->body);
     $requirement->sort = $request->input('sort', $requirement->sort);
     $requirement->created_by = $staffer ? $staffer->id : null;
     $requirement->save();
     // TODO: What should the response be?
     return '';
 }