Flow   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
lcom 0
cbo 1
dl 0
loc 50
rs 10
c 1
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A steps() 0 4 1
A transitions() 0 4 1
A scopeByModule() 0 4 1
A getActivePresentedAttribute() 0 4 2
1
<?php
2
3
namespace Hechoenlaravel\JarvisFoundation\Flows;
4
5
use Illuminate\Database\Eloquent\Model;
6
7
/**
8
 * Class Flow
9
 * @package Modules\Flows\Entities
10
 */
11
class Flow extends Model
12
{
13
    /**
14
     * @var string
15
     */
16
    public $table = "fl_flows";
17
18
    /**
19
     * the fillable columns
20
     * @var array
21
     */
22
    protected $fillable = ['name', 'description', 'module', 'active'];
23
24
    /**
25
     * The steps
26
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
27
     */
28
    public function steps()
29
    {
30
        return $this->hasMany(Step::class);
31
    }
32
33
    /**
34
     * The transitions
35
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
36
     */
37
    public function transitions()
38
    {
39
        return $this->hasMany(Transition::class);
40
    }
41
42
    /**
43
     * @param $query
44
     * @param $module
45
     * @return mixed
46
     */
47
    public function scopeByModule($query, $module)
48
    {
49
        return $query->where('module', $module);
50
    }
51
52
    /**
53
     * @param $value
54
     * @return string
55
     */
56
    public function getActivePresentedAttribute($value)
57
    {
58
        return empty($this->active) ? "No" : "Si";
59
    }
60
}
61