Traq\Models\Timeline::milestoneCompletedEvent PHP Method

milestoneCompletedEvent() public static method

Creates a new Timeline object relating to a milestone completion event.
public static milestoneCompletedEvent ( $user, $milestone ) : Timeline
return Timeline
    public static function milestoneCompletedEvent($user, $milestone)
    {
        return new static(['project_id' => $milestone['project_id'], 'owner_type' => 'Milestone', 'owner_id' => $milestone['id'], 'user_id' => $user['id'], 'action' => 'milestone_completed']);
    }

Usage Example

Example #1
0
 public function __construct()
 {
     parent::__construct();
     $this->title($this->translate('milestones'));
     $this->before(['edit', 'save', 'delete', 'destroy'], function () {
         $this->object = Milestone::find(Request::$properties->get('id'));
         if (!$this->object || $this->object->project_id != $this->currentProject['id']) {
             return $this->show404();
         }
     });
     $this->after('save', function () {
         if ($this->object->isBeingCompleted) {
             Timeline::milestoneCompletedEvent($this->currentUser, $this->object)->save();
         }
     });
 }
All Usage Examples Of Traq\Models\Timeline::milestoneCompletedEvent