Input::get('type'),
'email' => Input::get('email'),
'comment' => Input::get('comment')
),
array(
'type' => 'required|numeric|integer',
'email' => 'required|email',
'comment' => 'required'
)
);
/** If validation fails */
if ($validator->fails())
{
/** Prepare error message */
$message = '
Error(s) in the form
';
foreach ($validator->messages()->all('- :message
') as $validationError)
{
$message.=$validationError;
}
$message.='
';
/** Send error message and old data */
Session::flash('status', 'warning');
Session::flash('message', $message);
return Redirect::back()->withInput();
}
else
{
$data = array('type'=>'', 'comment'=>'', 'email'=>'');
$data['comment']=Input::get('comment');
$data['email']=Input::get('email');
switch (Input::get('type')) {
case '0':
$data['type']='Error Report';
break;
case '1':
$data['type']='Question';
break;
case '2':
$data['type']='Suggestion';
break;
case '3':
$data['type']='Other';
break;
default:
$data['type']='Other';
break;
}
Mail::send('emails.feedback-email-copy', $data, function($message){
$message
->to(Input::get('email'), Auth::user()->first_name.' '.Auth::user()->surnames)
// ->cc('oeae.rrp@upr.edu')
->cc('peticiones.diia@upr.edu')
->subject('Feedback for OLAS');
});
//peticiones.diia@upr.edu
Session::flash('status', 'success');
Session::flash('message', 'Success! Check your email for a copy of your message. Thank you for your feedback.
');
return Redirect::back();
}
}
}