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