Last active
August 29, 2015 14:22
-
-
Save kevtainer/740bc380fa7a73032a73 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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