public static function ExtractHotspot($selection = true) { $category = Viewlog::distinct('spot')->get()->toArray(); if ($selection) { $cats = array('' => 'All'); } else { $cats = array(); } //print_r($category); foreach ($category as $cat) { $cats[$cat[0]] = $cat[0]; } return $cats; }