'datetime', 'is_homepage' => 'boolean', 'show_in_menu' => 'boolean', 'sort_order' => 'integer', ]; public function author() { return $this->belongsTo(User::class, 'author_id'); } public function parent() { return $this->belongsTo(Page::class, 'parent_id'); } public function children() { return $this->hasMany(Page::class, 'parent_id'); } public function getRouteKeyName() { return 'slug'; } public function getUrlAttribute() { if ($this->is_homepage) { return '/'; } return '/' . $this->slug; } public function getFeaturedImageUrlAttribute() { if ($this->featured_image) { return asset('storage/' . $this->featured_image); } return null; } }