From 4368f5d1bbb7dfd902ddd08a8b1ff090b38085a7 Mon Sep 17 00:00:00 2001 From: merdan Date: Tue, 7 Apr 2020 19:28:50 +0500 Subject: [PATCH] settings and page view --- app/Models/Page.php | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) 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