Skip to content

Commit 1a8923b

Browse files
authored
fix compatibility for laravel 6
1 parent 25c6f22 commit 1a8923b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/Model.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Basemkhirat\Elasticsearch;
44

55
use Illuminate\Support\Collection;
6+
use Illuminate\Support\Str;
67

78
/**
89
* Elasticsearch data model
@@ -179,7 +180,7 @@ public function __get($name)
179180
*/
180181
protected function getOriginalAttribute($name)
181182
{
182-
$method = "get" . ucfirst(camel_case($name)) . "Attribute";
183+
$method = "get" . ucfirst(Str::camel($name)) . "Attribute";
183184
$value = method_exists($this, $method) ? $this->$method($this->attributes[$name]) : $this->attributes[$name];
184185
return $this->setAttributeType($name, $value);
185186
}
@@ -191,7 +192,7 @@ protected function getOriginalAttribute($name)
191192
*/
192193
protected function getAppendsAttribute($name)
193194
{
194-
$method = "get" . ucfirst(camel_case($name)) . "Attribute";
195+
$method = "get" . ucfirst(Str::camel($name)) . "Attribute";
195196
$value = method_exists($this, $method) ? $this->$method(NULL) : NULL;
196197
return $this->setAttributeType($name, $value);
197198
}
@@ -253,7 +254,7 @@ public function toJson($options = 0)
253254
public function __set($name, $value)
254255
{
255256

256-
$method = "set" . ucfirst(camel_case($name)) . "Attribute";
257+
$method = "set" . ucfirst(Str::camel($name)) . "Attribute";
257258

258259
$value = method_exists($this, $method) ? $this->$method($value) : $value;
259260

0 commit comments

Comments
 (0)