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();
}
});
}