Пример #1
0
 public function update($id)
 {
     app('Pingpong\\Admin\\Validation\\Defect\\Update')->validate($data = $this->inputAll());
     $defect = Defect::find($id);
     $data = \Input::All();
     isset($data['version_id']) ? $version = Version::find($data['version_id'])->number : ($version = Version::find($defect->version_id)->number);
     $destination = public_path() . '\\attachments\\' . $data['name'] . '\\' . $version . '\\';
     $dbdestination = 'attachments/' . $data['name'] . '/' . $version . '/';
     isset($data['version_id']) ? $defect->version_id = $data['version_id'] : ($defect->version_id = $defect->version_id);
     isset($data['summary']) ? $defect->summary = $data['summary'] : ($defect->summary = $defect->summary);
     isset($data['description']) ? $defect->description = $data['description'] : ($defect->description = $defect->description);
     isset($data['severity_id']) ? $defect->severity_id = $data['severity_id'] : ($defect->severity_id = $defect->severity_id);
     isset($data['priority_id']) ? $defect->priority_id = $data['priority_id'] : ($defect->priority_id = $defect->priority_id);
     isset($data['status_id']) ? $defect->status_id = $data['status_id'] : ($defect->status_id = $defect->status_id);
     $defect->save();
     if (isset($data['attachment'])) {
         $filename = $defect->id . '.' . $data['attachment']->getClientOriginalExtension();
         $data['attachment']->move($destination, $filename);
         $defect->attachment = $dbdestination . $filename;
         $defect->save();
     }
     $history = new History();
     $history->user_id = $data['user_id'];
     $history->defect_id = $defect->id;
     $history->status_id = $data['status_id'];
     $history->status_comment = $data['comment'];
     $history->save();
     return $this->redirect('defects.index');
 }
Пример #2
0
 /**
  * Remove the specified resource from storage.
  * DELETE /versions/{id}
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $project = Version::find($id);
     Version::destroy($id);
     return $this->redirect('projects.show', $project->project_id);
 }