Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
cheesegrits committed Mar 26, 2023
2 parents ac8fc8f + f6cac4b commit 49d99e1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 19 deletions.
27 changes: 13 additions & 14 deletions src/Fields/Map.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,19 @@ class Map extends Field
* Main field config variables
*/
private array $mapConfig = [
'autocomplete' => false,
'autocompleteReverse' => false,
'geolocate' => false,
'geolocateLabel' => '',
'draggable' => true,
'clickable' => false,
'defaultLocation' => [
'autocomplete' => false,
'autocompleteReverse' => false,
'geolocate' => false,
'geolocateLabel' => '',
'draggable' => true,
'clickable' => false,
'defaultLocation' => [
'lat' => 15.3419776,
'lng' => 44.2171392,
],
'controls' => [],
'drawingControl' => false,
'drawingModes' => [
'controls' => [],
'drawingControl' => false,
'drawingModes' => [
'marker' => true,
'circle' => true,
'rectangle' => true,
Expand Down Expand Up @@ -231,7 +231,6 @@ public function getGeolocateLabel(): string
/**
* Add drawing controls to the map
*
* @param Closure|bool $drawingControl
* @return $this
*/
public function drawingControl(Closure|bool $drawingControl = true): static
Expand Down Expand Up @@ -280,7 +279,6 @@ public function getDrawingField(): ?string
* 'rectangle' => true,
* ]
*
* @param Closure|array $drawingModes
* @return $this
*/
public function drawingModes(Closure|array $drawingModes): static
Expand Down Expand Up @@ -424,6 +422,7 @@ public function getMapControls(): string
$controls = $this->evaluate($this->mapControls);

return json_encode(array_merge($this->controls, $controls), JSON_THROW_ON_ERROR);

return json_encode(array_merge($this->controls, $controls), JSON_THROW_ON_ERROR);
}

Expand Down Expand Up @@ -539,7 +538,7 @@ public function mapsHasJs(): bool

public function mapsJsUrl(): string
{
$manifest = json_decode(file_get_contents(__DIR__ . '/../../dist/mix-manifest.json'), true);
$manifest = json_decode(file_get_contents(__DIR__.'/../../dist/mix-manifest.json'), true);

return url($manifest['/cheesegrits/filament-google-maps/filament-google-maps.js']);
}
Expand All @@ -551,7 +550,7 @@ public function mapsHasCss(): bool

public function mapsCssUrl(): string
{
$manifest = json_decode(file_get_contents(__DIR__ . '/../../dist/mix-manifest.json'), true);
$manifest = json_decode(file_get_contents(__DIR__.'/../../dist/mix-manifest.json'), true);

return url($manifest['/cheesegrits/filament-google-maps/filament-google-maps.css']);
}
Expand Down
9 changes: 4 additions & 5 deletions src/Filters/RadiusFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ class RadiusFilter extends BaseFilter

protected int|Closure|null $radius = null;

protected string | Closure | null $attribute = null;

protected string|Closure|null $attribute = null;

public function getColumns(): array|int|null
{
Expand Down Expand Up @@ -83,8 +82,8 @@ public function apply(Builder $query, array $data = []): Builder
// $sql = "((ACOS(SIN(? * PI() / 180) * SIN(" . $latName . " * PI() / 180) + COS(? * PI() / 180) * COS(" .
// $latName . " * PI() / 180) * COS((? - " . $lngName . ") * PI() / 180)) * 180 / PI()) * 60 * ?) as distance";

$sql = "((ACOS(SIN($latitude * PI() / 180) * SIN(" . $latName . " * PI() / 180) + COS($latitude * PI() / 180) * COS(" .
$latName . " * PI() / 180) * COS(($longitude - " . $lngName . ") * PI() / 180)) * 180 / PI()) * 60 * %f) < $distance";
$sql = "((ACOS(SIN($latitude * PI() / 180) * SIN(".$latName." * PI() / 180) + COS($latitude * PI() / 180) * COS(".
$latName." * PI() / 180) * COS(($longitude - ".$lngName.") * PI() / 180)) * 180 / PI()) * 60 * %f) < $distance";

$sql = sprintf($sql, $kilometers ? (1.1515 * 1.609344) : 1.1515);

Expand Down Expand Up @@ -257,7 +256,7 @@ public function isRelationship(): bool
return ! empty($this->getRelationship());
}

public function attribute(string | Closure | null $name): static
public function attribute(string|Closure|null $name): static
{
$this->attribute = $name;

Expand Down

0 comments on commit 49d99e1

Please sign in to comment.