Exemple #1
0
 public static function addValue($objectId, $metaKey, $metaValue)
 {
     $objectMeta = ObjectMeta::getMeta($objectId, $metaKey);
     if (!isset($objectMeta) || $objectMeta->meta_value != $metaValue) {
         $objectMeta = new ObjectMeta();
         $objectMeta->object_id = $objectId;
     }
     $objectMeta->meta_key = $metaKey;
     $objectMeta->meta_value = $metaValue;
     return $objectMeta->save();
 }
 public function getCategories($id = null)
 {
     //Config::set('laravel-debugbar::config.enabled', false);
     $categories = Object::where('objects.type', 'category')->where('parent_id', $id)->select(array('objects.id', 'objects.title', 'objects.name'))->get();
     $response = $categories;
     foreach ($categories as $category) {
         if ($contentImageId = ObjectMeta::getValue($category->id, '_content_image')) {
             if ($contentImageUrl = getImageSrc($contentImageId, 'medium')) {
                 $category['contentImageUrl'] = '/uploads/' . $contentImageUrl;
             }
         }
         if ($featuredImageId = ObjectMeta::getValue($category->id, '_featured_image')) {
             if ($featuredImageUrl = getImageSrc($featuredImageId, 'thumbnail')) {
                 $category['featuredImageUrl'] = '/uploads/' . $featuredImageUrl;
             }
         }
         $category['childrenCount'] = Object::where('objects.type', 'category')->where('parent_id', $category['id'])->count();
         $category['itemsCount'] = ObjectMeta::join('objects', 'object_meta.object_id', '=', 'objects.id')->where('meta_key', '_category_id')->where('meta_value', $category['id'])->where('objects.type', '<>', 'category')->groupBy('object_id')->count();
     }
     //        $categories = Object::leftJoin('objects as t1', function($join) {
     //            $join->on('objects.id', '=', 't1.parent_id');
     //        })
     //            ->where('objects.type', 'category')
     //        //->whereNull('objects.parent_id')
     //            ->where('t1.parent_id', $id)
     //            ->select(DB::raw('jini_t1.*'))
     //            ->get();
     //print_r($categories);
     //
     //        $response = array(
     //            'categories' => $categories
     //            //'contentImage' =>
     //        );
     return response()->json($categories);
 }
Exemple #3
0
 public function getLocations()
 {
     $results = $this->getSearch();
     $data = array();
     $locations = array('type' => 1, 'userMsg' => false);
     if (!empty($results)) {
         foreach ($results as $result) {
             if ($lat = ObjectMeta::getValue($result['id'], '_field_address-location-g')) {
                 if ($long = ObjectMeta::getValue($result['id'], '_field_address-location-k')) {
                     $location = array('geo_latitude' => $lat, 'geo_longitude' => $long, 'location' => '', 'title' => $result['title']);
                     $data[] = $location;
                 }
             }
         }
     }
     $locations['data'] = $data;
     return $locations;
     //return view('partials.map', compact( 'locations' ));
 }
Exemple #4
0
 private function processCategory(&$category)
 {
     if ($contentImageId = ObjectMeta::getValue($category->id, '_content_image')) {
         if ($contentImageUrl = getImageSrc($contentImageId, 'medium')) {
             $category['contentImageUrl'] = '/uploads/' . $contentImageUrl;
         }
     }
     if ($featuredImageId = ObjectMeta::getValue($category->id, '_featured_image')) {
         if ($featuredImageUrl = getImageSrc($featuredImageId, 'small')) {
             $category['featuredImageUrl'] = '/uploads/' . $featuredImageUrl;
             //                    $path = __DIR__ . '/../../../public/uploads/' . $featuredImageUrl;
             //                    echo $path . '<br />' . file_exists($path) . '<br />';
             //                    if (file_exists($path)) {
             //                        $type = pathinfo($path, PATHINFO_EXTENSION);
             //                        $data = file_get_contents($path);
             //                        $category['featuredImageUrl'] = base64_encode($data);
             //                    }
         }
     }
     $category['childrenCount'] = Object::where('objects.type', 'category')->where('parent_id', $category['id'])->count();
     $category['itemsCount'] = ObjectMeta::join('objects', 'object_meta.object_id', '=', 'objects.id')->where('meta_key', '_category_id')->where('meta_value', $category['id'])->where('objects.type', '<>', 'category')->groupBy('object_id')->count();
     return $category;
 }
Exemple #5
0
function addImage($object, $destinationPath, $picture, $filename, $newfileName, $extension, $mimeType, $fieldName)
{
    list($source_image_width, $source_image_height, $source_image_type) = getimagesize($destinationPath . $picture);
    $imageObjectInfo = array();
    $imageObjectInfo['width'] = $source_image_width;
    $imageObjectInfo['height'] = $source_image_height;
    $imageObjectInfo['filePath'] = $filename;
    $imageObjectInfo['sizes'] = array();
    if ($source_image_width > 1920) {
        //} || $source_image_height > 1080) {
        Thumbnail::generate_image_thumbnail($destinationPath . $picture, $destinationPath . $newfileName . '-resized.' . $extension, 1920, 1080);
        list($siw, $sih, $sit) = getimagesize($destinationPath . $newfileName . '-resized.' . $extension);
        rename($destinationPath . $newfileName . '-resized.' . $extension, $destinationPath . $newfileName . '-' . $siw . 'x' . $sih . '.' . $extension);
        $imageInfo = array();
        $imageInfo['fileName'] = $destinationPath . $newfileName . '-' . $siw . 'x' . $sih . '.' . $extension;
        $imageInfo['width'] = $siw;
        $imageInfo['height'] = $sih;
        $imageInfo['mimeType'] = $mimeType;
        $imageObjectInfo['sizes']['large'] = $imageInfo;
    }
    if ($source_image_width > 1024) {
        // || $source_image_height > 768) {
        Thumbnail::generate_image_thumbnail($destinationPath . $picture, $destinationPath . $newfileName . '-resized.' . $extension, 1024, 768);
        list($siw, $sih, $sit) = getimagesize($destinationPath . $newfileName . '-resized.' . $extension);
        rename($destinationPath . $newfileName . '-resized.' . $extension, $destinationPath . $newfileName . '-' . $siw . 'x' . $sih . '.' . $extension);
        $imageInfo = array();
        $imageInfo['fileName'] = $newfileName . '-' . $siw . 'x' . $sih . '.' . $extension;
        $imageInfo['width'] = $siw;
        $imageInfo['height'] = $sih;
        $imageInfo['mimeType'] = $mimeType;
        $imageObjectInfo['sizes']['medium'] = $imageInfo;
    }
    if ($source_image_width > 350) {
        //|| $source_image_height > 350) {
        Thumbnail::generate_image_thumbnail($destinationPath . $picture, $destinationPath . $newfileName . '-resized.' . $extension, 350, 350);
        list($siw, $sih, $sit) = getimagesize($destinationPath . $newfileName . '-resized.' . $extension);
        rename($destinationPath . $newfileName . '-resized.' . $extension, $destinationPath . $newfileName . '-' . $siw . 'x' . $sih . '.' . $extension);
        $imageInfo = array();
        $imageInfo['fileName'] = $newfileName . '-' . $siw . 'x' . $sih . '.' . $extension;
        $imageInfo['width'] = $siw;
        $imageInfo['height'] = $sih;
        $imageInfo['mimeType'] = $mimeType;
        $imageObjectInfo['sizes']['small'] = $imageInfo;
    }
    if ($source_image_width > 300) {
        //|| $source_image_height > 350) {
        Thumbnail::generate_image_thumbnail($destinationPath . $picture, $destinationPath . $newfileName . '-resized.' . $extension, 300, 300);
        list($siw, $sih, $sit) = getimagesize($destinationPath . $newfileName . '-resized.' . $extension);
        rename($destinationPath . $newfileName . '-resized.' . $extension, $destinationPath . $newfileName . '-' . $siw . 'x' . $sih . '.' . $extension);
        $imageInfo = array();
        $imageInfo['fileName'] = $newfileName . '-' . $siw . 'x' . $sih . '.' . $extension;
        $imageInfo['width'] = $siw;
        $imageInfo['height'] = $sih;
        $imageInfo['mimeType'] = $mimeType;
        $imageObjectInfo['sizes']['thumbnail'] = $imageInfo;
    }
    // Save image object
    if ($imageObjectId = ObjectMeta::getValue($object->id, $fieldName)) {
        $imageObject = Object::find($imageObjectId);
    }
    if (empty($imageObject)) {
        $imageObject = new Object();
    }
    $imageObject->author_id = Auth::user()->id;
    $imageObject->type = 'image';
    $imageObject->name = $newfileName . '.' . $extension;
    $imageObject->title = $filename;
    $imageObject->status = 'inherit';
    $imageObject->guid = $newfileName;
    $imageObject->save();
    ObjectMeta::setValue($imageObject->id, '_file_path', $newfileName . '.' . $extension);
    ObjectMeta::setValue($imageObject->id, '_image_info', serialize($imageObjectInfo));
    ObjectMeta::setValue($object->id, $fieldName, $imageObject->id);
    return $imageObject;
}
Exemple #6
0
 /**
  * Remove the specified resource from storage.
  *
  * @param $id
  * @return Response
  */
 public function postDelete(DeleteRequest $request, $id)
 {
     if ($object = object::find($id)) {
         $object->delete();
         ObjectMeta::where('object_id', $id)->delete();
         return redirect('admin/objects')->with('message', 'Type deleted successfully');
     }
 }
Exemple #7
0
                    echo '<div style="color: cornflowerblue; font-family: Arial, Helvetica, sans-serif;">' . '<div style="float: left; padding: 20px 10px 5px 5px;">' . '<span> #' . $index . '</span>' . '</div>' . '<div style="float: left;">' . '<span>ID: </span>' . $item['id'] . '<br>' . '<span>File name: </span>' . $item['filename'] . '<br>' . '<span>Error message: </span>' . $item['error'] . '</div>' . '</div>';
                    echo '<br>';
                }
            }
        }
    }
    if ($refreshThisPage) {
        die('<meta http-equiv="refresh" content="2">');
    } else {
        die('Done!');
    }
});
/* Crop and resize images */
Route::get('/crop', function () {
    ini_set('memory_limit', '1G');
    $results = \App\ObjectMeta::where('object_meta.meta_key', '_file_path')->join('object_meta AS om', function ($join) {
        $join->on('object_meta.object_id', '=', 'om.object_id')->where('om.meta_key', '=', '_image_info');
    })->join('object_meta AS om2', 'object_meta.object_id', '=', 'om2.meta_value')->join('objects as obj', 'obj.id', '=', 'om2.object_id')->select('object_meta.object_id', 'object_meta.meta_value AS path', 'om2.meta_key AS type', 'om2.object_id AS parentObjectID', 'obj.type AS parentObjectType')->groupBy('path')->get();
    //    dd($results->get()->toArray());
    if (isset($_GET['type']) && $_GET['type'] == 'content') {
        $content = $results->reject(function (&$v) {
            $v->info = unserialize($v->info);
            return $v->type == '_featured_image';
        });
        ini_set('max_execution_time', 300);
        $failed = array();
        foreach ($content as $image) {
            $x = autoCrop(0, $image->path, $image->type);
            //            echo $image->path . '<br>';
            //            echo $image->type . '<br>';
            //            var_dump($x);
 public function getLocations()
 {
     $results = $this->getSearchPage(true);
     $results = $results['items'];
     //        dd($results->toArray());
     $data = array();
     $locations = array('type' => 1, 'userMsg' => false);
     if (!empty($results)) {
         foreach ($results as $result) {
             if ($lat = ObjectMeta::getValue($result->id, '_field_address-location-g')) {
                 if ($long = ObjectMeta::getValue($result->id, '_field_address-location-k')) {
                     $location = array('id' => $result->id, 'geo_latitude' => $lat, 'geo_longitude' => $long, 'location' => '', 'title' => $result->title, 'name' => $result->name, 'excerpt' => $result->excerpt, 'score' => $result->score);
                     if ($contentImageId = ObjectMeta::getValue($result->id, '_content_image')) {
                         $location['content_image'] = Url('/uploads/' . getImageSrc($contentImageId, 'medium'));
                     } else {
                         $location['content_image'] = '';
                     }
                     $location['address_street'] = ObjectMeta::getValue($result->id, '_field_address-address');
                     $location['address_city'] = ObjectMeta::getValue($result->id, '_field_address-city');
                     $location['address_country'] = ObjectMeta::getValue($result->id, '_field_address-country');
                     $location['promoted'] = ObjectMeta::getValue($result->id, '_field_promoted');
                     $data[] = $location;
                 }
             }
         }
     }
     $options = array();
     foreach ($data as &$item) {
         if (isset($options[$item['geo_latitude'] . '_' . $item['geo_longitude']])) {
             $options[$item['geo_latitude'] . '_' . $item['geo_longitude']] += 1;
             $current = $options[$item['geo_latitude'] . '_' . $item['geo_longitude']] - 1;
             $lat = substr($item['geo_latitude'], -3);
             if ($lat + $current * 10 < 1000) {
                 $lat = $lat + $current * 10;
                 $subLat = substr($item['geo_latitude'], 0, strlen($item['geo_latitude']) - 3);
                 $item['geo_latitude'] = $subLat . $lat;
             } else {
                 $lat = substr($item['geo_latitude'], -4);
                 $lat = $lat + $current * 10;
                 $subLat = substr($item['geo_latitude'], 0, strlen($item['geo_latitude']) - 4);
                 $item['geo_latitude'] = $subLat . $lat;
             }
         } else {
             $options[$item['geo_latitude'] . '_' . $item['geo_longitude']] = 1;
         }
     }
     $locations['data'] = $data;
     return $locations;
     //return view('partials.map', compact( 'locations' ));
 }
 public function getCategories($id = null)
 {
     //Config::set('laravel-debugbar::config.enabled', false);
     $this->fetchCategories();
     foreach ($this->items as $category) {
         if ($contentImageId = ObjectMeta::getValue($category->id, '_content_image')) {
             if ($contentImageUrl = getImageSrc($contentImageId)) {
                 //                if ($contentImageUrl = getImageSrc($contentImageId, 'medium') ) {
                 $category['contentImageUrl'] = 'cropped/' . getTheImageSize($contentImageUrl, '_content_image');
                 //                    $category['contentImageUrl'] = $contentImageUrl;
             }
         }
         if ($featuredImageId = ObjectMeta::getValue($category->id, '_featured_image')) {
             if ($featuredImageUrl = getImageSrc($featuredImageId)) {
                 //                if ($featuredImageUrl = getImageSrc($featuredImageId, 'small')) {
                 $category['featuredImageUrl'] = 'cropped/' . getTheImageSize($featuredImageUrl, '_featured_image');
                 //                    $category['featuredImageUrl'] = $featuredImageUrl;
             }
         }
     }
     $this->itemsParents[0] = [];
     $categories = $this->itemArray();
     $this->items2 = $this->items->getDictionary();
     /*
     $time11 = microtime(true);
     foreach($this->items2 as $k => &$v)
     {
         if($v->items_count)
             continue;
     
         $objects = Object::whereNotIn('objects.type', ['object_type', 'image','category'])
             ->join('objects as obj', function ($join){
                 $join->on('obj.name', '=', DB::raw("concat( '_object_type_', objects.type )"));
             })
             ->join('object_meta', function ($join){
                 $join->on('object_meta.object_id', '=', 'obj.id')
                     ->where('object_meta.meta_key', '=', '_category_id');
             })
             ->join('objects as cat', function ($join){
                 $join->on('cat.id', '=', 'object_meta.meta_value');
             })
             ->where('object_meta.meta_value', $k)
             ->select('objects.id', 'objects.name')
             ->limit(2)
         ;
     
         if($objects->count() != 1)
             continue;
     
         $v->url = $objects->first()->toArray();
     }
     $time22 = microtime(true);
     */
     $categories2 = $this->itemArray2();
     $this->itemsParents2[0] = [];
     $breadCrumbs = [];
     $breadCrumbs[0] = [];
     foreach ($this->itemsParents as $itemID => $arr) {
         foreach ($arr as $subK) {
             $subItem = $this->items->getDictionary()[$subK];
             $breadCrumbs[$itemID][] = ['id' => $subK, 'title' => $subItem->title, 'url' => $subItem->name, 'hasItems' => (bool) $subItem->items_count];
         }
     }
     $currentItem = !$id ? false : ['id' => $id, 'title' => $this->items->getDictionary()[$id]['title'], 'contentImageUrl' => $this->items->getDictionary()[$id]['contentImageUrl'], 'featuredImageUrl' => $this->items->getDictionary()[$id]['featuredImageUrl']];
     //        echo "script execution time: ".($time22-$time11); //value in seconds
     return response()->json(['categories' => $categories2, 'parents' => $this->itemsParents, 'breadcrumbs' => $breadCrumbs, 'currentItem' => $currentItem]);
 }
Exemple #10
0
 public static function getFields($id)
 {
     return ObjectMeta::where('object_id', $id)->where('meta_key', 'LIKE', '_field_%');
 }
Exemple #11
0
 public static function getField($id, $name)
 {
     return ObjectMeta::where('object_id', $id);
     //->where('meta_key', '=', '_field_'. $name);
 }
 public function deleteField($id)
 {
     if ($field = ObjectMeta::find($id)) {
         $field->delete();
     }
 }
Exemple #13
0
function addImage($object, $destinationPath, $picture, $filename, $newfileName, $extension, $mimeType, $fieldName)
{
    list($source_image_width, $source_image_height, $source_image_type) = getimagesize($destinationPath . $picture);
    $imageObjectInfo = array();
    $imageObjectInfo['width'] = $source_image_width;
    $imageObjectInfo['height'] = $source_image_height;
    $imageObjectInfo['fileName'] = $filename;
    $imageObjectInfo['filePath'] = $newfileName . '.' . $extension;
    $imageObjectInfo['sizes'] = array();
    $x = autoCrop($destinationPath, $picture, $fieldName);
    if ($x !== false) {
        $round = (int) \App\ResizesTinypng::max('round') + 1;
        insertIntoTableResizes($round, getTheImageSize($picture, $fieldName), $destinationPath . 'cropped/' . getTheImageSize($picture, $fieldName), 0, 'N', 0, false);
        $results_table = selectByRoundNumber($round);
        if (!empty($results_table)) {
            foreach ($results_table as $res_row) {
                $result_array = array('id' => intval($res_row['id']), 'round' => intval($res_row['round']), 'filename' => $res_row['file_name'], 'path' => $res_row['path'], 'runTiny' => intval($res_row['run_tiny']), 'error' => $res_row['error'], 'timeTiny' => intval($res_row['time_tiny']), 'timeAdded' => intval($res_row['created_at']));
                $row_obj = array_to_object($result_array);
                $error_message = "N";
                //START >> tinify images
                $tmp_path = str_replace(getcwd() . '/', "", $row_obj->path);
                //GET SERVER PATH
                $save_path = str_replace($row_obj->filename, "", $tmp_path);
                //OVERRIDE CURRENT LOCATION
                $flag = tinifyImage($row_obj->path, $save_path);
                if ($flag === false) {
                    if ($error_message == "N") {
                        $error_message = "Y - Compression failed";
                    } else {
                        $error_message .= " - Compression failed";
                    }
                }
                //END << tinify image
                //UPDATE DB
                updateTableResizes($row_obj->id, $row_obj->round, $row_obj->filename, $row_obj->path, 1, $error_message, time(), $row_obj->timeAdded);
            }
        }
    }
    /*
        if ($source_image_width > 1920) {//} || $source_image_height > 1080) {
            Thumbnail::generate_image_thumbnail($destinationPath . $picture, $destinationPath . $newfileName . '-resized.'. $extension, 1920, 1080);
        list($siw, $sih, $sit) = getimagesize($destinationPath . $newfileName . '-resized.'. $extension);
        rename( $destinationPath . $newfileName . '-resized.'. $extension,
                $destinationPath . $newfileName . '-'. $siw . 'x'. $sih .  '.'. $extension);
        $imageInfo = array();
        $imageInfo['fileName'] = $destinationPath . $newfileName . '-'. $siw . 'x'. $sih .  '.'. $extension;
            $imageInfo['width'] = $siw;
            $imageInfo['height'] = $sih;
            $imageInfo['mimeType'] = $mimeType;
        $imageObjectInfo['sizes']['large'] = $imageInfo;
        }
    if ($source_image_width > 1024) { // || $source_image_height > 768) {
            Thumbnail::generate_image_thumbnail($destinationPath . $picture, $destinationPath . $newfileName . '-resized.'. $extension, 1024, 768);
        list($siw, $sih, $sit) = getimagesize($destinationPath . $newfileName . '-resized.'. $extension);
        rename( $destinationPath . $newfileName . '-resized.'. $extension,
                $destinationPath . $newfileName . '-'. $siw . 'x'. $sih .  '.'. $extension);
        $imageInfo = array();
        $imageInfo['fileName'] = $newfileName . '-'. $siw . 'x'. $sih .  '.'. $extension;
            $imageInfo['width'] = $siw;
            $imageInfo['height'] = $sih;
            $imageInfo['mimeType'] = $mimeType;
        $imageObjectInfo['sizes']['medium'] = $imageInfo;
        }
    if ($source_image_width > 350) {//|| $source_image_height > 350) {
            Thumbnail::generate_image_thumbnail($destinationPath . $picture, $destinationPath . $newfileName . '-resized.'. $extension, 350, 350);
        list($siw, $sih, $sit) = getimagesize($destinationPath . $newfileName . '-resized.'. $extension);
        rename( $destinationPath . $newfileName . '-resized.'. $extension,
                $destinationPath . $newfileName . '-'. $siw . 'x'. $sih .  '.'. $extension);
        $imageInfo = array();
        $imageInfo['fileName'] = $newfileName . '-'. $siw . 'x'. $sih .  '.'. $extension;
            $imageInfo['width'] = $siw;
            $imageInfo['height'] = $sih;
            $imageInfo['mimeType'] = $mimeType;
        $imageObjectInfo['sizes']['small'] = $imageInfo;
        }
    if ($source_image_width > 300) {//|| $source_image_height > 350) {
            Thumbnail::generate_image_thumbnail($destinationPath . $picture, $destinationPath . $newfileName . '-resized.'. $extension, 300, 300);
        list($siw, $sih, $sit) = getimagesize($destinationPath . $newfileName . '-resized.'. $extension);
        rename( $destinationPath . $newfileName . '-resized.'. $extension,
                $destinationPath . $newfileName . '-'. $siw . 'x'. $sih .  '.'. $extension);
        $imageInfo = array();
        $imageInfo['fileName'] = $newfileName . '-'. $siw . 'x'. $sih .  '.'. $extension;
            $imageInfo['width'] = $siw;
            $imageInfo['height'] = $sih;
            $imageInfo['mimeType'] = $mimeType;
        $imageObjectInfo['sizes']['thumbnail'] = $imageInfo;
        }
    */
    // Save image object
    if ($imageObjectId = ObjectMeta::getValue($object->id, $fieldName)) {
        $imageObject = Object::find($imageObjectId);
    }
    if (empty($imageObject)) {
        $imageObject = new Object();
    }
    $imageObject->author_id = Auth::user()->id;
    $imageObject->type = 'image';
    $imageObject->name = $newfileName . '.' . $extension;
    $imageObject->title = $filename;
    $imageObject->status = 'inherit';
    $imageObject->guid = $newfileName;
    $imageObject->save();
    ObjectMeta::setValue($imageObject->id, '_file_path', $newfileName . '.' . $extension);
    ObjectMeta::setValue($imageObject->id, '_image_info', serialize($imageObjectInfo));
    ObjectMeta::setValue($object->id, $fieldName, $imageObject->id);
    return $imageObject;
}
Exemple #14
0
 public function getLocations()
 {
     $results = $this->getSearch();
     $data = array();
     $locations = array('type' => 1, 'userMsg' => false);
     if (!empty($results)) {
         foreach ($results as $result) {
             if ($lat = ObjectMeta::getValue($result->id, '_field_address-location-g')) {
                 if ($long = ObjectMeta::getValue($result->id, '_field_address-location-k')) {
                     $location = array('geo_latitude' => $lat, 'geo_longitude' => $long, 'location' => '', 'title' => $result->title, 'excerpt' => $result->excerpt);
                     if ($contentImageId = ObjectMeta::getValue($result->id, '_content_image')) {
                         $location['content_image'] = Url('/uploads/' . getImageSrc($contentImageId, 'medium'));
                     } else {
                         $location['content_image'] = '';
                     }
                     $location['address_street'] = ObjectMeta::getValue($result->id, '_field_address-address');
                     $location['address_city'] = ObjectMeta::getValue($result->id, '_field_address-city');
                     $location['address_country'] = ObjectMeta::getValue($result->id, '_field_address-country');
                     $location['promoted'] = ObjectMeta::getValue($result->id, '_field_promoted');
                     $data[] = $location;
                 }
             }
         }
     }
     $locations['data'] = $data;
     return $locations;
     //return view('partials.map', compact( 'locations' ));
 }