/**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     // Fetch objects and delete redis sets
     $objects = Object::whereIn('object_id', Redis::smembers('objects:toReindex'))->get();
     $collections = Collection::whereIn('collection_id', Redis::smembers('collections:toReindex'))->get();
     $dataViews = DataView::whereIn('dataview_id', Redis::smembers('dataviews:toReindex'))->get();
     Redis::del(['objects:toReindex', 'collections:toReindex', 'dataviews:toReindex']);
     // Map to return searchable interfaces and reindex
     if ($objects->count() > 0) {
         foreach ($objects as $object) {
             $searchableObjects[] = $object->search();
         }
         Search::bulkReindex($searchableObjects);
     }
     if ($collections->count() > 0) {
         foreach ($collections as $collection) {
             $searchableCollections[] = $collection->search();
         }
         Search::bulkReindex($searchableCollections);
     }
     if ($dataViews->count() > 0) {
         foreach ($dataViews as $dataView) {
             $searchableDataViews[] = $dataView->search();
         }
         Search::bulkReindex($searchableDataViews);
     }
 }
 public function edit($dataViewId)
 {
     if ($this->dataview->isValid(Input::get('dataView'))) {
         $dataview = DataView::find($dataViewId)->fill(Input::get('dataView'))->get();
         $dataview->setColors();
         $dataview->save();
         return response()->json($dataview);
     }
     return response()->json(400);
 }