diff --git a/app/Models/Page.php b/app/Models/Page.php index 8722d33f..51b0f2fd 100644 --- a/app/Models/Page.php +++ b/app/Models/Page.php @@ -58,7 +58,8 @@ class Page extends Model public function getPageLink() { - return url($this->slug); + $slug = $this->slug?:Str::substr($this->slug,0,Str::length($this->slug)-3); + return url($slug); } public function getOpenButton() @@ -95,14 +96,6 @@ class Page extends Model return $this->title; } - public function getSlugAttribute(){ - if ($this->slug != '') { - return Str::substr($this->slug,0,Str::length($this->slug)-3); - - } - return $this->title; - } - /* |-------------------------------------------------------------------------- | MUTATORS