File: D:/HostingSpaces/SBogers10/tandartsmaas.komma.pro/app/Komma/SignUp/SignUpService.php
<?php
namespace Komma\SignUp;
use Komma\Email\Mailer\SignUpMailer;
use Komma\Forms\SignUpForm;
class SignUpService
{
/**
* @var SignUpForm
*/
private $signUpForm;
/**
* @var SignUpMailer
*/
private $signUpMailer;
/**
* @param SignUpForm $signUpForm
* @param SignUpMailer $signUpMailer
*/
public function __construct(SignUpForm $signUpForm, SignUpMailer $signUpMailer){
$this->signUpForm = $signUpForm;
$this->signUpMailer = $signUpMailer;
}
public function process()
{
$input = \Input::all();
// Validate form
if( ! $this->signUpForm->isValid($input))
{
return \Redirect::back()
->withData($input)
->withErrors($this->signUpForm->errorMessages());
}
// Send order to company
$this->signUpMailer->sendSubscription($input);
// Send confirmation email to customer
$this->signUpMailer->confirmToClient($input);
// Redirect with success message
return \Redirect::to( \Lang::get('pages.signUpThanks.route') )->with(['signUpThanksSuccess' => 1]);
}
}