Skip to content

Commit

Permalink
fix compatibility for laravel 6
Browse files Browse the repository at this point in the history
  • Loading branch information
basemkhirat authored Nov 27, 2019
1 parent 25c6f22 commit 1a8923b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Basemkhirat\Elasticsearch;

use Illuminate\Support\Collection;
use Illuminate\Support\Str;

/**
* Elasticsearch data model
Expand Down Expand Up @@ -179,7 +180,7 @@ public function __get($name)
*/
protected function getOriginalAttribute($name)
{
$method = "get" . ucfirst(camel_case($name)) . "Attribute";
$method = "get" . ucfirst(Str::camel($name)) . "Attribute";
$value = method_exists($this, $method) ? $this->$method($this->attributes[$name]) : $this->attributes[$name];
return $this->setAttributeType($name, $value);
}
Expand All @@ -191,7 +192,7 @@ protected function getOriginalAttribute($name)
*/
protected function getAppendsAttribute($name)
{
$method = "get" . ucfirst(camel_case($name)) . "Attribute";
$method = "get" . ucfirst(Str::camel($name)) . "Attribute";
$value = method_exists($this, $method) ? $this->$method(NULL) : NULL;
return $this->setAttributeType($name, $value);
}
Expand Down Expand Up @@ -253,7 +254,7 @@ public function toJson($options = 0)
public function __set($name, $value)
{

$method = "set" . ucfirst(camel_case($name)) . "Attribute";
$method = "set" . ucfirst(Str::camel($name)) . "Attribute";

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

Expand Down

0 comments on commit 1a8923b

Please sign in to comment.