File: D:/HostingSpaces/farmfun/reserveren.farmfun.be/app/Komma/Forms/VacancyController.php
<?php
namespace App\Komma\Forms;
use App\Http\Requests\ContactRequest;
use App\Http\Requests\VacancyRequest;
use App\Komma\Base\Controller;
use App\Mail\VacancyMail;
use Illuminate\Support\Facades\Mail;
final class VacancyController extends Controller
{
/**
* @var FormService
*/
private $formService;
/**
* QuotationController constructor.
* @param FormService $formService
*/
public function __construct(FormService $formService)
{
parent::__construct();
$this->formService = $formService;
$this->formService->setOrigin('vacancy');
}
/**
* Store the request and send it by e-mail
* Note: Validation is done in the request itself
*
* @param ContactRequest $request
* @return \Illuminate\Http\JsonResponse
*/
/**
* Store the request and send it by e-mail
* Note: Validation is done in the request itself
*
* @param VacancyRequest $request
// * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/
public function process(VacancyRequest $request)
{
// Store request in the database
$this->formService->storeRequest($request);
// Remove token from request (this creates and array)
Mail::send(new VacancyMail($request->except('_token')));
return redirect(localized_route('vacancy.success'));
}
/**
* Show page where we thank the user
*
* @return mixed
*/
public function success()
{
return view('site.templates.vacancies_success', [
'links' => $this->links,
'page' => $this->links->vacancies->node,
]);
}
}