Skip to content

Commit

Permalink
Fixed toArray after removing of fillable
Browse files Browse the repository at this point in the history
  • Loading branch information
LasseRafn committed Sep 20, 2017
1 parent e29482b commit 0fb3f86
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/Utils/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,12 @@ public function __toString()
public function toArray()
{
$data = [];
$class = new \ReflectionObject($this);
$properties = $class->getProperties(\ReflectionProperty::IS_PUBLIC);

foreach ( $this->fillable as $fillable )
{
if ( isset( $this->{$fillable} ) )
{
$data[ $fillable ] = $this->{$fillable};
}
/** @var \ReflectionProperty $property */
foreach ($properties as $property) {
$data[$property->getName()] = $this->{$property->getName()};
}

return $data;
Expand Down

0 comments on commit 0fb3f86

Please sign in to comment.