Skip to content

Commit

Permalink
Location
Browse files Browse the repository at this point in the history
  • Loading branch information
ianrothmann1 committed Aug 23, 2017
1 parent 6c741db commit f86a0be
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Rocket/RocketFieldSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
use IanRothmann\RocketDataLaravel\Rocket\Types\RocketFilesField;
use IanRothmann\RocketDataLaravel\Rocket\Types\RocketImageField;
use IanRothmann\RocketDataLaravel\Rocket\Types\RocketImagesField;
use IanRothmann\RocketDataLaravel\Rocket\Types\RocketLocationField;
use IanRothmann\RocketDataLaravel\Rocket\Types\RocketLongTextField;
use IanRothmann\RocketDataLaravel\Rocket\Types\RocketMultiSelectField;
use IanRothmann\RocketDataLaravel\Rocket\Types\RocketNumberField;
Expand Down Expand Up @@ -116,6 +117,15 @@ public function number($fieldName, $label){
return $this->addField(new RocketNumberField($fieldName,$label));
}

/**
* @param $fieldName
* @param $label
* @return RocketLocationField
*/
public function location($fieldName, $label='Location',$centerLat=null,$centerLong=null){
return $this->addField(new RocketLocationField($fieldName,$label,$centerLat,$centerLong));
}

/**
* @param $fieldName
* @param $label
Expand Down
5 changes: 5 additions & 0 deletions src/Rocket/Types/RocketField.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,17 @@ class RocketField
const TYPE_CURRENCY='currency';
const TYPE_SELECT='select';
const TYPE_MULTISELECT='multiselect';
const TYPE_LOCATION='location';


public static function text($fieldName,$label){
return new RocketTextField($fieldName,$label);
}

public static function location($fieldName,$label){
return new RocketLocationField($fieldName,$label);
}

public static function bool($fieldName, $label, $trueValue='Yes', $falseValue='No'){
return new RocketBoolField($fieldName,$label,$trueValue,$falseValue);
}
Expand Down
29 changes: 29 additions & 0 deletions src/Rocket/Types/RocketLocationField.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php
/**
* Created by PhpStorm.
* User: ian
* Date: 2017/06/28
* Time: 4:29 AM
*/

namespace IanRothmann\RocketDataLaravel\Rocket\Types;


use IanRothmann\RocketDataLaravel\Display\Query\FieldFilter;
use IanRothmann\RocketDataLaravel\Manipulate\EditableField;

class RocketLocationField extends EditableField
{
use RocketFieldCommon;

public $centerLat, $centerLng;

public function __construct($fieldName, $label, $centerLat=null, $centerLng=null)
{
parent::__construct($fieldName, RocketField::TYPE_LOCATION, $label);

$this->centerLat=$centerLat;
$this->centerLng=$centerLng;
}

}

0 comments on commit f86a0be

Please sign in to comment.