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.

118 lines
4.1 KiB

<?php
namespace App\Http\Controllers;
use App\Models\Recruitment;
use App\Models\Applicant;
use App\Models\User;
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.']);
}
public function apply(Request $request){
$this->validate(\request(),[
'full_name' => 'required',
'phone' => 'required',
'email' => 'required',
'file' => 'required',
'country' => 'required',
'has_visa_permit' => 'required',
'has_skill_assessed' => 'required',
'entered_captcha_code' => 'required|same:displayed_captcha_code'
]);
$recruitment = new Applicant();
$subject = 'Applicant Enquiry';
$recruitment->full_name = $request['full_name'];
$recruitment->country = $request['country'];
$recruitment->phone = $request['phone'];
$recruitment->email = $request['email'];
$recruitment->has_visa_permit = $request['has_visa_permit'];
$recruitment->has_skill_assessed = $request['has_skill_assessed'];
if($request->hasFile('file')){
$extension = \request()->file('file')->getClientOriginalExtension();
$image_folder_type = array_search('applicant',config('custom.image_folders')); //for image saved in folder
$count = rand(100,999);
$out_put_path = User::save_image(\request('file'),$extension,$count,$image_folder_type);
is_array($out_put_path) ? $recruitment->resume = $out_put_path[0] : $recruitment->resume = $out_put_path;
}
$recruitment->save();
dispatch(function() use ($subject, $recruitment) {
\Mail::send('applicant_mail', array(
'full_name' => $recruitment->full_name,
'email' => $recruitment->email,
'phone' => $recruitment->phone,
'country' => $recruitment->country,
'work_permit' => $recruitment->has_visa_permit,
'subject' =>$subject ,
'tra_skill' =>$recruitment->has_skill_assessed ,
), 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 details have been recieved.']);
}
}