Skip to content

Commit

Permalink
fromRawAttributes method on pivot
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed May 2, 2016
1 parent 9650f4f commit f356419
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/Illuminate/Database/Eloquent/Relations/Pivot.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,24 @@ public function __construct(Model $parent, $attributes, $table, $exists = false)
$this->timestamps = $this->hasTimestampAttributes();
}

/**
* Create a new pivot model from raw values returned from a query.
*
* @param \Illuminate\Database\Eloquent\Model $parent
* @param array $attributes
* @param string $table
* @param bool $exists
* @return static
*/
public static function fromRawAttributes(Model $parent, $attributes, $table, $exists = false)
{
$instance = new static($parent, $attributes, $table, $exists);

$instance->setRawAttributes($attributes, true);

return $instance;
}

/**
* Set the keys for a save update query.
*
Expand Down

0 comments on commit f356419

Please sign in to comment.