|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Cortex\Pages\Models; |
|
6
|
|
|
|
|
7
|
|
|
use Rinvex\Pages\Models\Page as BasePage; |
|
8
|
|
|
use Spatie\Activitylog\Traits\LogsActivity; |
|
9
|
|
|
|
|
10
|
|
|
/** |
|
11
|
|
|
* Cortex\Pages\Models\Page. |
|
12
|
|
|
* |
|
13
|
|
|
* @property int $id |
|
14
|
|
|
* @property string $uri |
|
15
|
|
|
* @property string $slug |
|
16
|
|
|
* @property string $domain |
|
17
|
|
|
* @property string $middleware |
|
18
|
|
|
* @property array $title |
|
19
|
|
|
* @property array $subtitle |
|
20
|
|
|
* @property array $excerpt |
|
21
|
|
|
* @property array $content |
|
22
|
|
|
* @property string $view |
|
23
|
|
|
* @property bool $is_active |
|
24
|
|
|
* @property int $sort_order |
|
25
|
|
|
* @property \Carbon\Carbon $created_at |
|
26
|
|
|
* @property \Carbon\Carbon $updated_at |
|
27
|
|
|
* @property \Carbon\Carbon $deleted_at |
|
28
|
|
|
* @property-read \Illuminate\Database\Eloquent\Collection|\Cortex\Foundation\Models\Log[] $activity |
|
29
|
|
|
* |
|
30
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\Rinvex\Pages\Models\Page active() |
|
31
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\Rinvex\Pages\Models\Page inactive() |
|
32
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\Rinvex\Pages\Models\Page ordered($direction = 'asc') |
|
33
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\Cortex\Pages\Models\Page whereContent($value) |
|
34
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\Cortex\Pages\Models\Page whereCreatedAt($value) |
|
35
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\Cortex\Pages\Models\Page whereDeletedAt($value) |
|
36
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\Cortex\Pages\Models\Page whereDomain($value) |
|
37
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\Cortex\Pages\Models\Page whereExcerpt($value) |
|
38
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\Cortex\Pages\Models\Page whereId($value) |
|
39
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\Cortex\Pages\Models\Page whereIsActive($value) |
|
40
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\Cortex\Pages\Models\Page whereMiddleware($value) |
|
41
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\Cortex\Pages\Models\Page whereSlug($value) |
|
42
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\Cortex\Pages\Models\Page whereSortOrder($value) |
|
43
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\Cortex\Pages\Models\Page whereSubtitle($value) |
|
44
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\Cortex\Pages\Models\Page whereTitle($value) |
|
45
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\Cortex\Pages\Models\Page whereUpdatedAt($value) |
|
46
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\Cortex\Pages\Models\Page whereUri($value) |
|
47
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\Cortex\Pages\Models\Page whereView($value) |
|
48
|
|
|
* @mixin \Eloquent |
|
49
|
|
|
*/ |
|
50
|
|
|
class Page extends BasePage |
|
51
|
|
|
{ |
|
52
|
|
|
use LogsActivity; |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* Indicates whether to log only dirty attributes or all. |
|
56
|
|
|
* |
|
57
|
|
|
* @var bool |
|
58
|
|
|
*/ |
|
59
|
|
|
protected static $logOnlyDirty = true; |
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* The attributes that are logged on change. |
|
63
|
|
|
* |
|
64
|
|
|
* @var array |
|
65
|
|
|
*/ |
|
66
|
|
|
protected static $logAttributes = [ |
|
67
|
|
|
'uri', |
|
68
|
|
|
'slug', |
|
69
|
|
|
'title', |
|
70
|
|
|
'route', |
|
71
|
|
|
'subtitle', |
|
72
|
|
|
'domain', |
|
73
|
|
|
'middleware', |
|
74
|
|
|
'excerpt', |
|
75
|
|
|
'content', |
|
76
|
|
|
'view', |
|
77
|
|
|
'is_active', |
|
78
|
|
|
'sort_order', |
|
79
|
|
|
]; |
|
80
|
|
|
|
|
81
|
|
|
/** |
|
82
|
|
|
* The attributes that are ignored on change. |
|
83
|
|
|
* |
|
84
|
|
|
* @var array |
|
85
|
|
|
*/ |
|
86
|
|
|
protected static $ignoreChangedAttributes = [ |
|
|
|
|
|
|
87
|
|
|
'created_at', |
|
88
|
|
|
'updated_at', |
|
89
|
|
|
'deleted_at', |
|
90
|
|
|
]; |
|
91
|
|
|
|
|
92
|
|
|
/** |
|
93
|
|
|
* Get the route key for the model. |
|
94
|
|
|
* |
|
95
|
|
|
* @return string |
|
96
|
|
|
*/ |
|
97
|
|
|
public function getRouteKeyName() |
|
98
|
|
|
{ |
|
99
|
|
|
return 'slug'; |
|
100
|
|
|
} |
|
101
|
|
|
|
|
102
|
|
|
/** |
|
103
|
|
|
* Get the class name for polymorphic relations. |
|
104
|
|
|
* |
|
105
|
|
|
* @return string |
|
106
|
|
|
*/ |
|
107
|
|
|
public function getMorphClass() |
|
108
|
|
|
{ |
|
109
|
|
|
return 'page'; |
|
110
|
|
|
} |
|
111
|
|
|
} |
|
112
|
|
|
|
Very long variable names usually make code harder to read. It is therefore recommended not to make variable names too verbose.