1 | <?php |
||
55 | class Page extends Model implements Sortable |
||
56 | { |
||
57 | use HasSlug; |
||
58 | use SortableTrait; |
||
59 | use HasTranslations; |
||
60 | use ValidatingTrait; |
||
61 | use CacheableEloquent; |
||
62 | |||
63 | /** |
||
64 | * {@inheritdoc} |
||
65 | */ |
||
66 | protected $fillable = [ |
||
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 | * {@inheritdoc} |
||
83 | */ |
||
84 | protected $casts = [ |
||
85 | 'uri' => 'string', |
||
86 | 'slug' => 'string', |
||
87 | 'route' => 'string', |
||
88 | 'domain' => 'string', |
||
89 | 'middleware' => 'string', |
||
90 | 'view' => 'string', |
||
91 | 'is_active' => 'boolean', |
||
92 | 'sort_order' => 'integer', |
||
93 | 'deleted_at' => 'datetime', |
||
94 | ]; |
||
95 | |||
96 | /** |
||
97 | * {@inheritdoc} |
||
98 | */ |
||
99 | protected $observables = [ |
||
100 | 'validating', |
||
101 | 'validated', |
||
102 | ]; |
||
103 | |||
104 | /** |
||
105 | * {@inheritdoc} |
||
106 | */ |
||
107 | public $translatable = [ |
||
108 | 'title', |
||
109 | 'subtitle', |
||
110 | 'excerpt', |
||
111 | 'content', |
||
112 | ]; |
||
113 | |||
114 | /** |
||
115 | * {@inheritdoc} |
||
116 | */ |
||
117 | public $sortable = [ |
||
118 | 'order_column_name' => 'sort_order', |
||
119 | ]; |
||
120 | |||
121 | /** |
||
122 | * The default rules that the model will validate against. |
||
123 | * |
||
124 | * @var array |
||
125 | */ |
||
126 | protected $rules = []; |
||
127 | |||
128 | /** |
||
129 | * Whether the model should throw a |
||
130 | * ValidationException if it fails validation. |
||
131 | * |
||
132 | * @var bool |
||
133 | */ |
||
134 | protected $throwValidationExceptions = true; |
||
135 | |||
136 | /** |
||
137 | * Create a new Eloquent model instance. |
||
138 | * |
||
139 | * @param array $attributes |
||
140 | */ |
||
141 | public function __construct(array $attributes = []) |
||
161 | |||
162 | /** |
||
163 | * Get the options for generating the slug. |
||
164 | * |
||
165 | * @return \Spatie\Sluggable\SlugOptions |
||
166 | */ |
||
167 | public function getSlugOptions(): SlugOptions |
||
174 | |||
175 | /** |
||
176 | * Activate the page. |
||
177 | * |
||
178 | * @return $this |
||
179 | */ |
||
180 | public function activate() |
||
186 | |||
187 | /** |
||
188 | * Deactivate the page. |
||
189 | * |
||
190 | * @return $this |
||
191 | */ |
||
192 | public function deactivate() |
||
198 | } |
||
199 |
Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.