Example #1
0
 public function newIssue()
 {
     $issue = new \O2s\Issues\Models\Issue();
     $createdby = 'Guest';
     if (\Auth::user()) {
         $createdby = \Auth::user()->email;
     }
     $issue->created_by = $createdby;
     $issue->title = \Input::get('title');
     $issue->description = \Input::get('description');
     $issue->kind = \Input::get('kind');
     $issue->priority = \Input::get('priority');
     $issues->url = \Input::get('url');
     $issue->save();
     return \Response::json(['state', 'success']);
 }
Example #2
0
 public function update(array $data)
 {
     $data = $this->sanitize($data);
     $model = new \O2s\Issues\Models\Issue();
     $issue = $model->find($data['id']);
     if ($issue) {
         $issue->title = $data['title'];
         $issue->description = $data['description'];
         $issue->kind = $data['kind'];
         $issue->priority = $data['priority'];
         $issue->status = $data['status'];
         $issue->save();
         return $issue;
     } else {
         throw new InvalidArgumentException('Invalid issue specified');
     }
 }