*/ protected $fillable = [ 'width', 'height', 'sort', 'active', 'settings' ]; protected $appends = [ 'title', ]; public function getTitleAttribute() { return __('dashboard.title_' . $this->name); } public static function toObject() { $all = self::orderBy('sort')->get(); $tiles = new \stdClass(); foreach ($all as $tile) { $key = $tile->name; $tiles->$key = $tile; } return $tiles; } public static function activeToObject() { $all = self::where('active', true)->orderBy('sort')->get(); $tiles = new \stdClass(); foreach ($all as $tile) { $key = $tile->name; $tiles->$key = $tile; } return collect($tiles); } }