Beispiel #1
0
 /**
  * Perform a model insert operation.
  *
  * @param  October\Rain\Halcyon\Builder  $query
  * @param  array  $options
  * @return bool
  */
 protected function performInsert(Builder $query, array $options = [])
 {
     if ($this->fireModelEvent('creating') === false) {
         return false;
     }
     // Ensure the settings attribute is passed through so this distinction
     // is recognised, mainly by the processor.
     $attributes = $this->attributesToArray();
     $query->insert($attributes);
     // We will go ahead and set the exists property to true, so that it is set when
     // the created event is fired, just in case the developer tries to update it
     // during the event. This will allow them to do so and run an update here.
     $this->exists = true;
     $this->fireModelEvent('created', false);
     return true;
 }