Skip to content

Instantly share code, notes, and snippets.

@ryaan-anthony
Last active August 29, 2015 14:11
Show Gist options
  • Select an option

  • Save ryaan-anthony/eaa9d340e6f9756ab116 to your computer and use it in GitHub Desktop.

Select an option

Save ryaan-anthony/eaa9d340e6f9756ab116 to your computer and use it in GitHub Desktop.
<?php
Product::create([
'sku' => 'foo',
'name' => 'Standard Foo',
'price' => 8.99,
'special_price' => 6.99,
'categories' => ['category' => [1,3,5]]
]);
<?php
$product = Product::find(1);
$product->update(['categories' => ['category' => [1,3,5]]]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment