@@ 9-36 (lines=28) @@ | ||
6 | use Illuminate\Database\Eloquent\SoftDeletes; |
|
7 | use Emadadly\LaravelUuid\Uuids; |
|
8 | ||
9 | class History extends Model |
|
10 | { |
|
11 | use SoftDeletes; |
|
12 | use Uuids; |
|
13 | ||
14 | ||
15 | public $fillable = ['content_type','content_id','workflow_id','workflow_transition_id','from_state','to_state','user_id','message']; |
|
16 | ||
17 | public function user() |
|
18 | { |
|
19 | return $this->hasOne('App\User','id','user_id'); |
|
20 | } |
|
21 | ||
22 | public function workflow() |
|
23 | { |
|
24 | return $this->hasOne('Bantenprov\VueWorkflow\Models\Workflow','id','workflow_id'); |
|
25 | } |
|
26 | ||
27 | public function fromState() |
|
28 | { |
|
29 | return $this->hasOne('Bantenprov\VueWorkflow\Models\State','id','from_state'); |
|
30 | } |
|
31 | ||
32 | public function toState() |
|
33 | { |
|
34 | return $this->hasOne('Bantenprov\VueWorkflow\Models\State','id','to_state'); |
|
35 | } |
|
36 | } |
|
37 | ||
38 |
@@ 9-41 (lines=33) @@ | ||
6 | use Illuminate\Database\Eloquent\SoftDeletes; |
|
7 | use Emadadly\LaravelUuid\Uuids; |
|
8 | ||
9 | class Transition extends Model |
|
10 | { |
|
11 | use SoftDeletes; |
|
12 | use Uuids; |
|
13 | ||
14 | public $table = 'workflow_transition'; |
|
15 | ||
16 | public $fillable = ['workflow_id','name','label','message','from','to']; |
|
17 | ||
18 | public function getWorkflow(){ |
|
19 | return $this->belongsTo('Bantenprov\VueWorkflow\Models\Workflow','workflow_id'); |
|
20 | } |
|
21 | ||
22 | public function state() |
|
23 | { |
|
24 | return $this->belongsTo('Bantenprov\VueWorkflow\Models\State','to','id'); |
|
25 | } |
|
26 | ||
27 | public function stateFrom() |
|
28 | { |
|
29 | return $this->belongsTo('Bantenprov\VueWorkflow\Models\State','from','id'); |
|
30 | } |
|
31 | ||
32 | public function stateTo() |
|
33 | { |
|
34 | return $this->belongsTo('Bantenprov\VueWorkflow\Models\State','to','id'); |
|
35 | } |
|
36 | ||
37 | public function vueGuard() |
|
38 | { |
|
39 | return $this->hasOne('Bantenprov\VueGuard\Models\VueGuardModel','transition_id'); |
|
40 | } |
|
41 | } |
|
42 |