forked from anonaddy/anonaddy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rule.php
55 lines (44 loc) · 924 Bytes
/
Rule.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
<?php
namespace App;
use App\Traits\HasUuid;
use Illuminate\Database\Eloquent\Model;
class Rule extends Model
{
use HasUuid;
public $incrementing = false;
protected $keyType = 'string';
protected $fillable = [
'name',
'conditions',
'actions',
'operator',
'active',
'order'
];
protected $dates = [
'created_at',
'updated_at'
];
protected $casts = [
'id' => 'string',
'user_id' => 'string',
'active' => 'boolean',
'conditions' => 'array',
'actions' => 'array'
];
/**
* Get the user for the rule.
*/
public function user()
{
return $this->belongsTo(User::class);
}
public function deactivate()
{
$this->update(['active' => false]);
}
public function activate()
{
$this->update(['active' => true]);
}
}