File: D:/HostingSpaces/SBogers10/straffer.komma.nl/app/Komma/Mailers/MailService.php
<?php
namespace Komma\Mailers;
use Illuminate\Support\Facades\Input;
class MailService extends Mailer
{
public function offer($inputs){
$this->makeRules(
[
'naam'=> 'required',
'email'=> 'required|email',
'onderwerp'=> 'required',
'bericht'=> 'required',
'privacy'=> 'required',
]);
$validated = $this->validate($inputs);
if($validated && is_bool($validated))
{
$view = 'emails.contactForm';
$to = \Config::get('mail.sendTo.address');
$subject = 'Contactformulier Website';
$this->sendTo($to, $subject, $view, $inputs);
return 'true';
}
else{
$error = [];
if($validated->first('naam')!=""){
$error['naam'] = $validated->first('naam');
}
if($validated->first('bedrijf')!=""){
$error['bedrijf'] = $validated->first('bedrijf');
}
if($validated->first('email')!=""){
$error['email'] = $validated->first('email');
}
if($validated->first('onderwerp')!=""){
$error['onderwerp'] = $validated->first('onderwerp');
}
if($validated->first('bericht')!=""){
$error['bericht'] = $validated->first('bericht');
}
if($validated->first('privacy')!=""){
$error['privacy'] = $validated->first('privacy');
}
return $error;
}
}
}