'boolean', ]; /** * The attributes that are translatable. * * @var array */ protected $translatedAttributes = ['name', 'body']; /** * The attribute that will be slugged. * * @var string */ protected $slugAttribute = 'name'; /** * Perform any actions required after the model boots. * * @return void */ protected static function booted() { static::addActiveGlobalScope(); } public static function urlForPage($id) { return static::select('slug')->firstOrNew(['id' => $id])->url(); } public function url() { if (is_null($this->slug)) { return '#'; } return localized_url(locale(), $this->slug); } /** * Get table data for the resource * * @return \Illuminate\Http\JsonResponse */ public function table() { return new AdminTable($this->newQuery()->withoutGlobalScope('active')); } }