/**
  * Handle the add isssue command.
  *
  * @param \Gitamin\Commands\Issue\AddIssueCommand $command
  *
  * @return \Gitamin\Models\Issue
  */
 public function handle(AddIssueCommand $command)
 {
     $data = ['author_id' => $command->authorId, 'project_id' => $command->projectId, 'title' => $command->title, 'description' => $command->description, 'created_at' => Carbon::now()->toDateTimeString()];
     // Create the issue
     $issue = Issue::create($data);
     return $issue;
 }
 /**
  * Handle the report issue command.
  *
  * @param \Gitamin\Commands\Issue\AddIssueCommand $command
  *
  * @return \Gitamin\Models\Issue
  */
 public function handle(AddIssueCommand $command)
 {
     $data = ['title' => $command->title, 'description' => $command->description];
     // Link with the user.
     if ($command->author_id) {
         $data['author_id'] = $command->author_id;
     }
     // Link with the project.
     if ($command->project_id) {
         $data['project_id'] = $command->project_id;
     }
     // Create the issue
     $issue = Issue::create($data);
     event(new IssueWasAddedEvent($issue));
     return $issue;
 }
 /**
  * Handle the report issue command.
  *
  * @param \Gitamin\Commands\Issue\AddIssueCommand $command
  *
  * @return \Gitamin\Models\Issue
  */
 public function handle(AddIssueCommand $command)
 {
     $data = ['name' => $command->name, 'status' => $command->status, 'message' => $command->message, 'visible' => $command->visible];
     // Link with the user.
     if ($command->user_id) {
         $data['user_id'] = $command->user_id;
     }
     // Link with the project.
     if ($command->project_id) {
         $data['project_id'] = $command->project_id;
     }
     // The issue occurred at a different time.
     if ($command->issue_date) {
         $issueDate = $this->dates->createNormalized('d/m/Y H:i', $command->issue_date);
         $data['created_at'] = $issueDate;
         $data['updated_at'] = $issueDate;
     }
     // Create the issue
     $issue = Issue::create($data);
     $issue->notify = (bool) $command->notify;
     event(new IssueWasAddedEvent($issue));
     return $issue;
 }
Esempio n. 4
0
 /**
  * Seed the issues table.
  */
 protected function seedIssues()
 {
     $defaultIssues = [['title' => 'Awesome', 'description' => ':+1: We totally nailed the fix.', 'author_id' => 1, 'project_id' => 1], ['title' => 'Monitoring the fix', 'description' => ":ship: We've deployed a fix.", 'author_id' => 3, 'project_id' => 2], ['title' => 'Update', 'description' => "We've identified the problem. Our engineers are currently looking at it.", 'author_id' => 2, 'project_id' => 1], ['title' => 'Test Issue', 'description' => 'Something went wrong, with something or another.', 'author_id' => 1, 'project_id' => 2], ['title' => 'Investigating the API', 'description' => ':zap: We\'ve seen high response times from our API. It looks to be fixing itself as time goes on.', 'author_id' => 1, 'project_id' => 3]];
     foreach ($defaultIssues as $issue) {
         Issue::create($issue);
     }
 }
Esempio n. 5
0
 /**
  * Seed the issues table.
  *
  * @return void
  */
 protected function seedIssues()
 {
     $defaultIssues = [['name' => 'Awesome', 'message' => ':+1: We totally nailed the fix.', 'status' => 4, 'project_id' => 0, 'scheduled_at' => null, 'visible' => 1], ['name' => 'Monitoring the fix', 'message' => ":ship: We've deployed a fix.", 'status' => 3, 'project_id' => 0, 'scheduled_at' => null, 'visible' => 1], ['name' => 'Update', 'message' => "We've identified the problem. Our engineers are currently looking at it.", 'status' => 2, 'project_id' => 0, 'scheduled_at' => null, 'visible' => 1], ['name' => 'Test Issue', 'message' => 'Something went wrong, with something or another.', 'status' => 1, 'project_id' => 0, 'scheduled_at' => null, 'visible' => 1], ['name' => 'Investigating the API', 'message' => ':zap: We\'ve seen high response times from our API. It looks to be fixing itself as time goes on.', 'status' => 1, 'project_id' => 1, 'scheduled_at' => null, 'visible' => 1]];
     Issue::truncate();
     foreach ($defaultIssues as $issue) {
         Issue::create($issue);
     }
 }