Step   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
lcom 0
cbo 4
dl 0
loc 41
rs 10
c 1
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A flow() 0 4 1
A transitions() 0 4 1
A transformed() 0 6 1
1
<?php
2
3
namespace Hechoenlaravel\JarvisFoundation\Flows;
4
5
use Hechoenlaravel\JarvisFoundation\Flows\Transformers\StepTransformer;
6
use Illuminate\Database\Eloquent\Model;
7
use League\Fractal\Manager;
8
use League\Fractal\Resource\Item;
9
10
/**
11
 * Class Step
12
 * @package Modules\Flows\Entities
13
 */
14
class Step extends Model
15
{
16
    /**
17
     * @var string
18
     */
19
    public $table = "fl_flows_steps";
20
21
    /**
22
     * @var array
23
     */
24
    protected $fillable = ['name', 'description', 'order', 'is_last'];
25
26
    /**
27
     * The flow this step belongs to
28
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
29
     */
30
    public function flow()
31
    {
32
        return $this->belongsTo(Flow::class);
33
    }
34
35
    /**
36
     * The possible transitions from this step
37
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
38
     */
39
    public function transitions()
40
    {
41
        return $this->hasMany(Transition::class, 'step_from_id');
42
    }
43
44
    /**
45
     * Model Transformed
46
     * @return \League\Fractal\Scope
47
     */
48
    public function transformed()
49
    {
50
        $manager = new Manager();
51
        $resource = new Item($this, new StepTransformer());
52
        return $manager->createData($resource);
53
    }
54
}
55