HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
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]);
    }
}