| @@ 244-271 (lines=28) @@ | ||
| 241 | * |
|
| 242 | * @return Eloquent\Model |
|
| 243 | */ |
|
| 244 | public function changeStatus($status, UserInterface $user) |
|
| 245 | { |
|
| 246 | if ($status == 0) { |
|
| 247 | $this->closed_by = $user->id; |
|
| 248 | $this->closed_at = (new \DateTime())->format('Y-m-d H:i:s'); |
|
| 249 | $activityType = Activity::TYPE_CLOSE_ISSUE; |
|
| 250 | } else { |
|
| 251 | $this->closed_by = 0; |
|
| 252 | $this->closed_at = null; |
|
| 253 | $activityType = Activity::TYPE_REOPEN_ISSUE; |
|
| 254 | } |
|
| 255 | ||
| 256 | /* Add to activity log */ |
|
| 257 | $this->activities()->save(new User\Activity([ |
|
| 258 | 'type_id' => $activityType, |
|
| 259 | 'parent_id' => $this->project->id, |
|
| 260 | 'user_id' => $user->id, |
|
| 261 | ])); |
|
| 262 | ||
| 263 | $this->status = $status; |
|
| 264 | ||
| 265 | // Add event on successful save |
|
| 266 | static::saved(function (Project\Issue $issue) use ($user) { |
|
| 267 | $this->queueUpdate($issue, $user); |
|
| 268 | }); |
|
| 269 | ||
| 270 | return $this->save(); |
|
| 271 | } |
|
| 272 | ||
| 273 | /** |
|
| 274 | * Sync the issue tags. |
|
| @@ 39-66 (lines=28) @@ | ||
| 36 | * |
|
| 37 | * @return Eloquent\Model |
|
| 38 | */ |
|
| 39 | public function changeStatus($status, User $user) |
|
| 40 | { |
|
| 41 | if ($status == 0) { |
|
| 42 | $this->closed_by = $user->id; |
|
| 43 | $this->closed_at = (new \DateTime())->format('Y-m-d H:i:s'); |
|
| 44 | $activityType = Activity::TYPE_CLOSE_ISSUE; |
|
| 45 | } else { |
|
| 46 | $this->closed_by = 0; |
|
| 47 | $this->closed_at = null; |
|
| 48 | $activityType = Activity::TYPE_REOPEN_ISSUE; |
|
| 49 | } |
|
| 50 | ||
| 51 | /* Add to activity log */ |
|
| 52 | $this->activities()->save(new User\Activity([ |
|
| 53 | 'type_id' => $activityType, |
|
| 54 | 'parent_id' => $this->project->id, |
|
| 55 | 'user_id' => $user->id, |
|
| 56 | ])); |
|
| 57 | ||
| 58 | $this->status = $status; |
|
| 59 | ||
| 60 | // Add event on successful save |
|
| 61 | static::saved(function (Project\Issue $issue) use ($user) { |
|
| 62 | $this->queueUpdate($issue, $user); |
|
| 63 | }); |
|
| 64 | ||
| 65 | return $this->save(); |
|
| 66 | } |
|
| 67 | ||
| 68 | /** |
|
| 69 | * Sync the issue tags. |
|