aplus#35
Mahesh Sharma 2 years ago
parent a6e81c2200
commit cb9d3aa285
  1. 25
      app/Http/Controllers/RecruitmentController.php
  2. 18
      app/Http/Requests/ContactRequest.php
  3. 51
      app/Http/Requests/Recruitment/ApplyRequest.php
  4. 45
      app/Http/Requests/Recruitment/VacancyRequest.php
  5. 2
      resources/views/contact.blade.php

@ -6,17 +6,13 @@ use App\Models\Recruitment;
use App\Models\Applicant; use App\Models\Applicant;
use App\Models\User; use App\Models\User;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\Http\Requests\Recruitment\ApplyRequest;
use App\Http\Requests\Recruitment\VacancyRequest;
class RecruitmentController extends Controller class RecruitmentController extends Controller
{ {
public function save_vacancy(Request $request){ public function save_vacancy(VacancyRequest $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(); $recruitment = new Recruitment();
$subject = 'Recruitment Enquiry'; $subject = 'Recruitment Enquiry';
@ -55,17 +51,8 @@ class RecruitmentController extends Controller
return redirect()->back()->with(['msg' => 'Thank you! Your recruitment details have been recieved.']); return redirect()->back()->with(['msg' => 'Thank you! Your recruitment details have been recieved.']);
} }
public function apply(Request $request){ public function apply(ApplyRequest $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(); $recruitment = new Applicant();
$subject = 'Applicant Enquiry'; $subject = 'Applicant Enquiry';

@ -13,7 +13,7 @@ class ContactRequest extends FormRequest
*/ */
public function authorize() public function authorize()
{ {
return false; return true;
} }
/** /**
@ -24,21 +24,23 @@ class ContactRequest extends FormRequest
public function rules() public function rules()
{ {
return [ return [
'fullname' => 'required', 'fullname' => ['required'],
'phone' => 'required', 'phone' => ['required'],
'email' => 'required', 'email' => ['required'],
'service_id' => 'required|numeric', 'service_id' => ['required'],
'entered_captcha_code' => 'required|same:displayed_captcha_code' 'entered_captcha_code' => ['required','same:displayed_captcha_code']
]; ];
} }
public function message(){ public function messages(){
return[ return[
'fullname.required' => 'Full name is required.', 'fullname.required' => 'Full name is required.',
'phone.required' => 'Phone is required.', 'phone.required' => 'Phone number is required.',
'email.required' => 'Email is required.', 'email.required' => 'Email is required.',
'service_id.required' => 'Please select a service.', 'service_id.required' => 'Please select a service.',
'entered_captcha_code.required' => 'Please enter captcha.',
'entered_captcha_code.same' => 'Captcha is incorrect.'
]; ];
} }

@ -0,0 +1,51 @@
<?php
namespace App\Http\Requests\Recruitment;
use Illuminate\Foundation\Http\FormRequest;
class ApplyRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, mixed>
*/
public function rules()
{
return [
'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']
];
}
public function messages()
{
return [
'full_name.required' => 'Full name is required.',
'phone.required' => 'Phone number is required.',
'email.required' => 'Email is required.',
'file.required' => 'Please upload your resume.',
'country.required' => 'Please select your country.',
'has_visa_permit.required' => 'Please specify your visa permit position.',
'has_skill_assesed.required' => 'Please specify your TRA skill assessment.',
'entered_captcha_code.required' => 'Please enter captcha.',
'entered_captcha_code.same' => 'Captcha is incorrect.'
];
}
}

@ -0,0 +1,45 @@
<?php
namespace App\Http\Requests\Recruitment;
use Illuminate\Foundation\Http\FormRequest;
class VacancyRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, mixed>
*/
public function rules()
{
return [
'full_name' => 'required',
'company' => 'required',
'email' => 'required',
'no_of_position' => 'required',
'entered_captcha_code' => ['required','same:displayed_captcha_code']
];
}
public function messages()
{
return [
'full_name.required' => 'Full name is required.',
'company.required' => 'Your company is required.',
'email.required' => 'Email is required.',
'no_of_position.required' => 'Number of position is required',
'entered_captcha_code.required' => 'Please enter captcha.',
'entered_captcha_code.same' => 'Captcha is incorrect.'
];
}
}

@ -94,7 +94,7 @@
<div class="mb-3"> <div class="mb-3">
<label for="">Services</label> <label for="">Services</label>
<select name="service_id" id="" class="form-select"> <select name="service_id" id="" class="form-select">
<option hidden>Choose service</option> <option hidden value = ''>Choose service</option>
@foreach($services as $service) @foreach($services as $service)
<option value="{{$service->id}}" class="aplus-display-select">{{$service->name}}</option> <option value="{{$service->id}}" class="aplus-display-select">{{$service->name}}</option>
@endforeach @endforeach

Loading…
Cancel
Save