forked from REBELinBLUE/deployer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDeployStep.php
79 lines (71 loc) · 1.69 KB
/
DeployStep.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
namespace REBELinBLUE\Deployer;
use Illuminate\Database\Eloquent\Model;
use McCool\LaravelAutoPresenter\HasPresenter;
use REBELinBLUE\Deployer\View\Presenters\DeployStepPresenter;
/**
* The deployment step model.
*/
class DeployStep extends Model implements HasPresenter
{
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = ['stage', 'deployment_id', 'command_id'];
/**
* The attributes that should be casted to native types.
*
* @var array
*/
protected $casts = [
'id' => 'integer',
'command_id' => 'integer',
'deployment_id' => 'integer',
'stage' => 'integer',
'optional' => 'boolean',
];
/**
* Has many relationship.
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function servers()
{
return $this->hasMany(ServerLog::class);
}
/**
* Belong to relationship.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function command()
{
return $this->belongsTo(Command::class)
->withTrashed();
}
/**
* Gets the view presenter.
*
* @return string
*/
public function getPresenterClass()
{
return DeployStepPresenter::class;
}
/**
* Determines if the step is a BEFORE or AFTER step.
*
* @return bool
*/
public function isCustom()
{
return (!in_array($this->stage, [
Command::DO_CLONE,
Command::DO_INSTALL,
Command::DO_ACTIVATE,
Command::DO_PURGE,
], true));
}
}