Skip to content

Commit ea0b7d6

Browse files
chuangbotimgws
authored andcommitted
Support Laravel 4 (again) (#66)
* Revert "Methods that Elasticquent assumes will be implemented by, and inherited from, Eloquent." - This reverts commit 1166490. - Support Laravel 4. Fix #63. * Disable vendor:publish for laravel 4 #63
1 parent 54b80bf commit ea0b7d6

File tree

4 files changed

+13
-38
lines changed

4 files changed

+13
-38
lines changed

src/ElasticquentServiceProvider.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@ class ElasticquentServiceProvider extends ServiceProvider
1313
*/
1414
public function boot()
1515
{
16-
$this->publishes([
17-
__DIR__.'/config/elasticquent.php' => config_path('elasticquent.php'),
18-
]);
16+
if (ElasticquentSupport::isLaravel5()) {
17+
$this->publishes([
18+
__DIR__.'/config/elasticquent.php' => config_path('elasticquent.php'),
19+
]);
20+
}
1921
}
2022

2123
/**

src/ElasticquentSupport.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,14 @@
22

33
namespace Elasticquent;
44

5+
use Illuminate\Foundation\Application;
6+
57
class ElasticquentSupport
68
{
79
use ElasticquentClientTrait;
10+
11+
public static function isLaravel5()
12+
{
13+
return version_compare(Application::VERSION, '5', '>');
14+
}
815
}

src/ElasticquentTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616
trait ElasticquentTrait
1717
{
18-
use ElasticquentClientTrait, EloquentMethods;
18+
use ElasticquentClientTrait;
1919

2020
/**
2121
* Uses Timestamps In Index

src/EloquentMethods.php

Lines changed: 0 additions & 34 deletions
This file was deleted.

0 commit comments

Comments
 (0)