'Startseite', 'search' => 'Suche', 'default' => 'Standartseiten', 'overview' => 'Übersicht', 'program' => 'Programme', 'booking' => 'Buchungen', 'bookingconfirm' => 'Buchungsbestätigung', ]; protected static $components = [ 'aboutSternToursWidget' => 'Wir: STERN TOURS', 'searchSidebarWidget' => 'Kulturreisen suchen', 'navSidebarWidget' => 'Reiseprogramme', 'topVotingWidget' => 'TOP bewertet', 'feedbacksSidebarWidget' => 'Kundenfeedback', 'travelGuideSidebarWidget' => 'Reiseführer', 'travelMagazineSidebarWidget' => 'Reisemagazin', 'offersSidebarWidget' => 'Angebote', ]; protected $connection = 'mysql_stern'; protected $table = 'sidebar_widgets'; protected $casts = ['show_at' => 'array']; protected $fillable = [ 'name', 'component', 'html', 'show_at', 'pos', 'active' ]; public static function getComponentsOptions($setKey = false){ $options = self::$components; $ret = '\n'; foreach ($options as $key => $option){ $attr = ($key == $setKey) ? 'selected="selected"' : ''; $ret .= '\n'; } return $ret; } public static function getShowsOptions($setKey){ if(!is_array($setKey)) $setKey = []; $options = self::$shows; $ret = ""; foreach ($options as $key => $option){ $attr = in_array($key, $setKey) ? 'selected="selected"' : ''; $ret .= '\n'; } return $ret; } public function getShowsAtString(){ $ret = ""; if($this->show_at){ foreach($this->show_at as $show_at){ if(isset(self::$shows[$show_at])){ $ret .= self::$shows[$show_at].", "; } } } return rtrim($ret, ", "); } /* * public function getVotesDetailAttribute($details) { return json_decode($details, true); } then when you will call $store->votes_detail you will get the expected result. After that you can use mutators to convert an array back to JSON when it is saved back in the DB. Define the method setVotesDetailAttribute($value) as follows: public function setVotesDetailsAttribute($value) { $this->attributes['votes_detail'] = json_encode($value); } */ }