You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

55 lines
1.8 KiB

<?php
namespace App\Http\Controllers;
use App\Models\Recruitment;
use Illuminate\Http\Request;
class RecruitmentController extends Controller
{
public function save_vacancy(Request $request){
$this->validate(\request(),[
'full_name' => 'required',
'company' => 'required',
'email' => 'required',
'no_of_position' => 'required',
'entered_captcha_code' => 'required|same:displayed_captcha_code'
]);
$recruitment = new Recruitment();
$subject = 'Recruitment Enquiry';
$recruitment->full_name = $request['full_name'];
$recruitment->company = $request['company'];
$recruitment->email = $request['email'];
$recruitment->no_of_position = $request['no_of_position'];
$recruitment->enquiry = $request['enquiry'];
$recruitment->save();
dispatch(function() use ($subject, $recruitment) {
\Mail::send('recruitment_mail', array(
'full_name' =>$recruitment['full_name'],
'email' =>$recruitment['email'],
'company' =>$recruitment['company'],
'enquiry' =>$recruitment['enquiry'],
'no_of_position' =>$recruitment['no_of_position'],
'subject' =>$subject ,
), function($message) use ($subject){
// $subject=($service!= '') ? 'Enquiry for '.$service : 'Contact/Feedback';
$message->subject($subject);
// $message->to('info@agilityhomecare.com.au', 'AgilityHomeCare')->subject($subject);
$message->to('mahesh@extratechs.com.au', 'Extratech')->subject($subject);
});
});
return redirect()->back()->with(['success' => 'Thank you! Your recruitment details have been recieved.']);
}
}