Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ matrix:
env: ILLUMINATE_VERSION=5.5.*
- php: 7.1
env: ILLUMINATE_VERSION=5.6.*
- php: 7.1
env: ILLUMINATE_VERSION=5.7.*

before_install:
- if [[ $TRAVIS_PHP_VERSION != 7.1 && $TRAVIS_PHP_VERSION != hhvm ]] ; then phpenv config-rm xdebug.ini; fi
Expand Down
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
"php": ">=7.0",
"elasticsearch/elasticsearch": "~5.3.0",
"ongr/elasticsearch-dsl": "5.*",
"illuminate/container": "5.2.*|5.3.*|5.4.*|5.5.*|5.6.*",
"illuminate/contracts": "5.2.*|5.3.*|5.4.*|5.5.*|5.6.*",
"illuminate/console": "5.2.*|5.3.*|5.4.*|5.5.*|5.6.*",
"illuminate/pagination": "5.2.*|5.3.*|5.4.*|5.5.*|5.6.*",
"illuminate/support": "5.2.*|5.3.*|5.4.*|5.5.*|5.6.*",
"illuminate/database": "5.2.*|5.3.*|5.4.*|5.5.*|5.6.*"
"illuminate/container": "5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*",
"illuminate/contracts": "5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*",
"illuminate/console": "5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*",
"illuminate/pagination": "5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*",
"illuminate/support": "5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*",
"illuminate/database": "5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*"
},
"require-dev": {
"phpunit/phpunit": "~4.0",
Expand Down
4 changes: 2 additions & 2 deletions src/DSL/SearchBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ public function geoShape($field, $type, array $coordinates = [], array $attribut
{
$query = new GeoShapeQuery();

$query->addShape($field, $type, $coordinates, $attributes);
$query->addShape($field, $type, $coordinates, GeoShapeQuery::INTERSECTS, $attributes);

$this->append($query);

Expand Down Expand Up @@ -869,6 +869,6 @@ public function append($query)
*/
protected function getCurrentPage($current)
{
return $current ?: (int) \Request::get('page', 1);
return $current ?: (int) app('request')->get('page', 1);
}
}
6 changes: 5 additions & 1 deletion src/MappingServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,10 @@ protected function registerMakeCommand()
*/
protected function registerAlias()
{
AliasLoader::getInstance()->alias('Map', Map::class);
if (class_exists('Illuminate\Foundation\AliasLoader')) {
AliasLoader::getInstance()->alias('Map', Map::class);
} elseif (!class_exists('Map')) {
class_alias(Map::class, 'Map');
}
}
}
2 changes: 1 addition & 1 deletion src/Mappings/Mapping.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ abstract class Mapping
/**
* Eloquent instance.
*
* @var Model
* @var Model|Searchable
*/
protected $model;

Expand Down
8 changes: 3 additions & 5 deletions src/PlasticManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@

namespace Sleimanx2\Plastic;

use Illuminate\Foundation\Application;

class PlasticManager
{
/**
* @var Application
* @var \Illuminate\Foundation\Application|\Laravel\Lumen\Application
*/
private $app;

Expand All @@ -19,9 +17,9 @@ class PlasticManager
/**
* PlasticManager constructor.
*
* @param Application $app
* @param \Illuminate\Foundation\Application|\Laravel\Lumen\Application $app
*/
public function __construct(Application $app)
public function __construct($app)
{
$this->app = $app;
}
Expand Down
14 changes: 12 additions & 2 deletions src/PlasticServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,15 @@ class PlasticServiceProvider extends ServiceProvider
*/
public function boot()
{
if (function_exists('config_path')) {
$publishPath = config_path('plastic.php');
} else {
$publishPath = base_path('config/plastic.php');
}

// Publish the configuration path
$this->publishes([
__DIR__.'/Resources/config.php' => config_path('plastic.php'),
__DIR__.'/Resources/config.php' => $publishPath,
]);

// Create the mapping folder
Expand Down Expand Up @@ -74,6 +80,10 @@ protected function registerProviders()
*/
protected function registerAlias()
{
AliasLoader::getInstance()->alias('Plastic', Plastic::class);
if (class_exists('Illuminate\Foundation\AliasLoader')) {
AliasLoader::getInstance()->alias('Plastic', Plastic::class);
} elseif (!class_exists('Plastic')) {
class_alias(Plastic::class, 'Plastic');
}
}
}
2 changes: 2 additions & 0 deletions src/Searchable.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ public function getDocumentIndex()
if (isset($this->documentIndex) and !empty($this->documentIndex)) {
return $this->documentIndex;
}

return function_exists('config') ? config('plastic.index') : 'plastic';
}

/**
Expand Down
1 change: 1 addition & 0 deletions tests/DSL/SearchBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ public function it_set_a_geoShape_query()
'type' => 'point',
'coordinates' => [3.3, 33.3],
],
'relation' => 'intersects',
],
],
],
Expand Down
4 changes: 2 additions & 2 deletions tests/SearchableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ public function it_gets_the_elastic_index_from_index_field_if_set()
/**
* @test
*/
public function it_returns_null_as_elastic_index_if_no_index_field()
public function it_return_default_index_if_no_index_field()
{
$model = new SearchableModelTest();
$this->assertEquals(null, $model->getDocumentIndex());
$this->assertEquals('plastic', $model->getDocumentIndex());
}

/**
Expand Down