Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save payamomrani/b747154c65e2b32e325c83400bbafec5 to your computer and use it in GitHub Desktop.
Save payamomrani/b747154c65e2b32e325c83400bbafec5 to your computer and use it in GitHub Desktop.
public function updateFromArray(array $attributes)
{
$this->id = array_get($attributes, 'id', $this->id);
$this->qty = array_get($attributes, 'qty', $this->qty);
$this->name = array_get($attributes, 'name', $this->name);
$this->price = array_get($attributes, 'price', $this->price);
$this->priceTax = $this->price + $this->tax;
$this->options = new CartItemOptions(array_get($attributes, 'options', $this->options));
//$this->rowId = $this->generateRowId($this->id, $this->options->all());
$this->rowId = array_get($attributes, 'rowId', $this->rowId);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment