[ 'source' => 'slug_or_title', ], ]; } /* |-------------------------------------------------------------------------- | FUNCTIONS |-------------------------------------------------------------------------- */ public function getTemplateName() { return str_replace('_', ' ', title_case($this->template)); } public function getPageLink() { return url($this->slug); } public function getOpenButton() { return ''. ' '.trans('backpack::pagemanager.open').''; } /* |-------------------------------------------------------------------------- | RELATIONS |-------------------------------------------------------------------------- */ /* |-------------------------------------------------------------------------- | SCOPES |-------------------------------------------------------------------------- */ /* |-------------------------------------------------------------------------- | ACCESORS |-------------------------------------------------------------------------- */ // The slug is created automatically from the "name" field if no slug exists. public function getSlugOrTitleAttribute() { if ($this->slug != '') { return $this->slug; } return $this->title; } /* |-------------------------------------------------------------------------- | MUTATORS |-------------------------------------------------------------------------- */ }