Exemplo n.º 1
0
 /**
  * Add an item to this collection.
  *
  * @param $object
  * @param null $key
  * @return mixed
  * @throws Exception
  */
 public function set($object, $key = null)
 {
     if (is_null($key)) {
         return $this->attributes[] = $object;
     }
     if (array_key_exists($key, $this->attributes)) {
         throw new Exception("Key '{$key}' already exists");
     }
     return Arr::set($key, $object, $this->attributes);
 }