private function setDeploymentStatus()
{
$this->deployment->status = Deployment::PENDING;
$this->deployment->started_at = date('Y-m-d H:i:s');
$this->deployment->project_id = $this->project->id;
if (Auth::check()) {
$this->deployment->user_id = Auth::user()->id;
} else {
$this->deployment->is_webhook = true;
}
$this->deployment->committer = $this->deployment->committer ?: Deployment::LOADING;
$this->deployment->commit = $this->deployment->commit ?: Deployment::LOADING;
$this->deployment->save();
$this->deployment->project->status = Project::PENDING;
$this->deployment->project->save();
}