forked from REBELinBLUE/deployer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCommand.php
68 lines (60 loc) · 1.66 KB
/
Command.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
<?php
namespace REBELinBLUE\Deployer;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use REBELinBLUE\Deployer\Traits\BroadcastChanges;
use REBELinBLUE\Deployer\Traits\HasTarget;
/**
* The command model.
*/
class Command extends Model
{
use SoftDeletes, BroadcastChanges, HasTarget;
const BEFORE_CLONE = 1;
const DO_CLONE = 2;
const AFTER_CLONE = 3;
const BEFORE_INSTALL = 4;
const DO_INSTALL = 5;
const AFTER_INSTALL = 6;
const BEFORE_ACTIVATE = 7;
const DO_ACTIVATE = 8;
const AFTER_ACTIVATE = 9;
const BEFORE_PURGE = 10;
const DO_PURGE = 11;
const AFTER_PURGE = 12;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = ['name', 'user', 'script', 'target_type', 'target_id',
'step', 'order', 'optional', 'default_on', ];
/**
* The attributes excluded from the model's JSON form.
*
* @var array
*/
protected $hidden = ['created_at', 'deleted_at', 'updated_at'];
/**
* The attributes that should be casted to native types.
*
* @var array
*/
protected $casts = [
'id' => 'integer',
'step' => 'integer',
'optional' => 'boolean',
'default_on' => 'boolean',
'order' => 'integer',
];
/**
* Belongs to many relationship.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
*/
public function servers()
{
return $this->belongsToMany(Server::class)
->orderBy('order', 'ASC');
}
}