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

RoutePath::parameters()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
crap 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