'array']; /** * The attributes that are mass assignable. * * @var array */ protected $guarded = []; public function parent() { return $this->belongsTo(Menu::class, 'parent_id', 'id'); } public function getParentNameAttribute() { return Menu::query()->where('id', $this->attributes['parent_id'])->value('name') ?? '--'; } public function getMetaAttribute() { $meta = js2php($this->attributes['meta']); if (App::getLocale() == 'en') { $meta['title'] = $this->attributes['zh_title']; } else { $meta['title'] = $this->attributes['en_title']; } return $meta; } }