Completed
Push — master ( 3a2708...31f349 )
by ARCANEDEV
13s
created

RoutePath   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 50%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 57
ccs 4
cts 8
cp 0.5
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A route() 0 6 1
A parameters() 0 6 1
1
<?php namespace Arcanedev\LaravelTracker\Models;
2
3
/**
4
 * Class     RoutePath
5
 *
6
 * @package  Arcanesoft\Tracker\Models
7
 * @author   ARCANEDEV <[email protected]>
8
 *
9
 * @property  int             id
10
 * @property  int             route_id
11
 * @property  string          path
12
 * @property  \Carbon\Carbon  created_at
13
 * @property  \Carbon\Carbon  updated_at
14
 *
15
 * @property  \Arcanedev\LaravelTracker\Models\Route    route
16
 * @property  \Illuminate\Database\Eloquent\Collection  parameters
17
 */
18
class RoutePath extends AbstractModel
19
{
20
    /* ------------------------------------------------------------------------------------------------
21
     |  Properties
22
     | ------------------------------------------------------------------------------------------------
23
     */
24
    /**
25
     * The table associated with the model.
26
     *
27
     * @var string
28
     */
29
    protected $table = 'route_paths';
30
31
    /**
32
     * The attributes that are mass assignable.
33
     *
34
     * @var array
35
     */
36
    protected $fillable = ['route_id', 'path'];
37
38
    /**
39
     * The attributes that should be cast to native types.
40
     *
41
     * @var array
42
     */
43
    protected $casts = [
44
        'route_id' => 'integer',
45
    ];
46
47
    /* ------------------------------------------------------------------------------------------------
48
     |  Relationships
49
     | ------------------------------------------------------------------------------------------------
50
     */
51
    /**
52
     * Route relationship.
53
     *
54
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
55
     */
56
    public function route()
57
    {
58
        return $this->belongsTo(
59
            $this->getModelClass(self::MODEL_ROUTE, Route::class)
60
        );
61
    }
62
63
    /**
64
     * Parameters relationship.
65
     *
66
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
67
     */
68 6
    public function parameters()
69
    {
70 6
        return $this->hasMany(
71 6
            $this->getModelClass(self::MODEL_ROUTE_PATH_PARAMETER, RoutePathParameter::class)
72 3
        );
73
    }
74
}
75