Skip to content

Instantly share code, notes, and snippets.

@kevtainer
Last active August 29, 2015 14:22
Show Gist options
  • Save kevtainer/740bc380fa7a73032a73 to your computer and use it in GitHub Desktop.
Save kevtainer/740bc380fa7a73032a73 to your computer and use it in GitHub Desktop.
public function createStandalone($data) {
$data['state_id'] = State::getIdFromCode($data['state']);
$data['type'] = $data['address_type'];
$data['addressee'] = $data['first_name'] . ' ' . $data['last_name'];
$data['reference'] = 'brochures';
$address = new Address($data);
$request = $this->model->newInstance();
$request->number = 1;
// ditch the email event trigger - otherwise it'll go out without the associated address saved on it
$request::flushEventListeners();
$request->save();
$request->addresses()->save($address);
// trigger event manually because we trashed it above
$admin_emailer = App::make('Pasta\Notification\AdminEmailer');
$admin_emailer->onBrochureRequestCreated($request, $data);
return $request;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment