/** * @param array $types * * @return \Illuminate\Support\Collection */ public function getWidgetsByType(array $types = null) { $widgets = new Widget(); if (is_array($types) and count($types) > 0) { $widgets->whereIn('widgets.type', $types); } return static::buildWidgetCollection($widgets->get()); }