public function destroy($id)
 {
     try {
         Caste::destroy($id);
     } catch (QueryException $ex) {
         return Redirect::back()->with('alert-warning', 'Caste is in Use!');
     }
     return Redirect::route($this->route . 'index')->with('alert-success', 'Successfully Deleted!');
 }
 public function run()
 {
     Caste::create(['name' => 'GENERAL']);
     Caste::create(['name' => 'OBC']);
     Caste::create(['name' => 'OBC\'A\'']);
     Caste::create(['name' => 'OBC\'B\'']);
     Caste::create(['name' => 'SCHEDULED CASTE']);
     Caste::create(['name' => 'SCHEDULED TRIBE']);
 }
 public function buildForm()
 {
     $this->add('post_name', 'text', ['attr' => ['required', 'maxlength' => '255', 'placeholder' => 'name of the POST', 'title' => 'name of the position'], 'wrapper' => ['class' => 'form-group-sm col-md-5']]);
     $this->add('no_of_post', 'number', ['attr' => ['required', 'maxlength' => '3', 'placeholder' => 'no of vacancy', 'title' => 'total position vacant'], 'wrapper' => ['class' => 'form-group-sm col-md-3']]);
     $this->add('industry_id', 'select', ['choices' => IndustryType::lists('name', 'id')->all(), 'empty_value' => '--- Select ---', 'attr' => ['required'], 'label' => 'Industry :', 'wrapper' => ['class' => 'form-group-sm col-md-4']]);
     $this->add('place_of_employment_state_id', 'select', ['choices' => State::lists('name', 'id')->all(), 'empty_value' => '--- Select ---', 'label' => 'Place of Employment State', 'attr' => ['required', 'id' => 'place_of_employment_state_id'], 'wrapper' => ['class' => 'form-group-sm col-md-4']]);
     $districts = ['' => '-- Select State first--'];
     $this->add('place_of_employment_district_id', 'select', ['choices' => $districts, 'label' => 'District', 'attr' => ['required', 'id' => 'place_of_employment_district_id', 'required'], 'wrapper' => ['class' => 'form-group-sm col-md-4']]);
     // ->add('some_choices', 'choices', [
     //            'choices' => $this->getData('post_choices')     // When form is created passed as ->setData('post_choices', ['some' => 'array'])
     //        ])
     $this->add('place_of_employment_city', 'text', ['attr' => ['maxlength' => '255', 'placeholder' => 'City'], 'wrapper' => ['class' => 'form-group-sm col-md-4']]);
     $this->add('salary_offered_min', 'text', ['attr' => ['required', 'maxlength' => '8', 'placeholder' => 'salary offered min'], 'wrapper' => ['class' => 'form-group-sm col-md-4'], 'label' => 'Salary Offered Min. (monthly)']);
     $this->add('salary_offered_max', 'text', ['attr' => ['required', 'maxlength' => '8', 'placeholder' => 'salary offered max'], 'wrapper' => ['class' => 'form-group-sm col-md-4'], 'label' => 'Salary Offered Max. (monthly)']);
     $this->add('other_benefits', 'text', ['attr' => ['maxlength' => '8', 'placeholder' => 'salary other_benefits'], 'wrapper' => ['class' => 'form-group-sm col-md-4'], 'label' => 'Other Benefits (annual)']);
     $this->add('preferred_age_min', 'number', ['attr' => ['required', 'maxlength' => '2', 'placeholder' => 'preferred_age_min', 'min' => "15", 'max' => "99"], 'wrapper' => ['class' => 'form-group-sm col-md-3']]);
     $this->add('preferred_age_max', 'number', ['attr' => ['required', 'maxlength' => '2', 'placeholder' => 'preferred_age_max', 'min' => "15", 'max' => "99"], 'wrapper' => ['class' => 'form-group-sm col-md-3']]);
     $casts = ['ANY' => 'ANY'] + Caste::lists('name', 'id')->all();
     $this->add('preferred_caste', 'select', ['choices' => $casts, 'empty_value' => '==== Select ===', 'label' => 'Preferred Caste', 'attr' => ['required'], 'wrapper' => ['class' => 'form-group-sm col-md-3']]);
     // $relegions = ['ANY'=>'ANY','BUDDHISM'=>'BUDDHISM', 'CHRISTIANITY'=>'CHRISTIANITY','HINDUISM'=>'HINDUISM','ISLAM'=>'ISLAM',
     //     'JAINISM'=>'JAINISM','PARSI'=>'PARSI','SIKHISM'=>'SIKHISM', 'OTHERS'=>'OTHERS',
     // ];
     // $this->add('preferred_relegion', 'select', [
     //         'choices' => $relegions,
     //         'empty_value' => '==== Select ===',
     //         'label' => 'Preferred Relegion',
     //         'attr' => ['required'],
     //         'wrapper' => ['class' => 'form-group-sm col-md-3'] // Shows the wrapper default is false
     // ]);
     $job_sub_categories = ['Govt. Regular' => 'Govt. Regular', 'Govt. Contractual' => 'Govt. Contractual', 'Pvt. Regular' => 'Pvt. Regular', 'Pvt. Contractual' => 'Pvt. Contractual', 'Not Specified' => 'Not Specified'];
     $this->add('job_sub_category', 'select', ['choices' => $job_sub_categories, 'empty_value' => ' ==== Select === ', 'label' => 'Job Category', 'attr' => ['required'], 'wrapper' => ['class' => 'form-group-sm col-md-3']]);
     $genders = ['ANY' => 'ANY', 'MALE' => 'MALE', 'FEMALE' => 'FEMALE', 'OTHERS' => 'OTHERS'];
     $this->add('preferred_sex', 'select', ['choices' => $genders, 'empty_value' => '==== Select ===', 'label' => 'Preferred Sex', 'attr' => ['required'], 'wrapper' => ['class' => 'form-group-sm col-md-3']]);
     $job_types = ['Full Time' => 'Full Time', 'Part Time' => 'Part Time'];
     $this->add('job_type', 'select', ['choices' => $job_types, 'empty_value' => '-- Select --', 'label' => 'Job Type', 'attr' => ['required'], 'wrapper' => ['class' => 'form-group-sm col-md-2']]);
     $this->add('exam_passed_id', 'select', ['choices' => Exam::lists('name', 'id')->all(), 'empty_value' => '--- Select ---', 'label' => 'Exam Passed :', 'attr' => ['required'], 'wrapper' => ['class' => 'form-group-sm col-md-3']]);
     $this->add('subject_id', 'select', ['choices' => Subject::lists('name', 'id')->all(), 'empty_value' => '--- Select ---', 'label' => 'Subject/Trade :', 'wrapper' => ['class' => 'form-group-sm col-md-4']]);
     $this->add('specialization', 'text', ['attr' => ['maxlength' => '50', 'placeholder' => 'specialization'], 'wrapper' => ['class' => 'form-group-sm col-md-4']]);
     $this->add('preferred_experience', 'number', ['attr' => ['maxlength' => '2', 'placeholder' => 'preferred years of expereince'], 'wrapper' => ['class' => 'form-group-sm col-md-2']]);
     $this->add('ex_service', 'select', ['choices' => ['YES' => 'YES', 'NO' => 'NO'], 'empty_value' => '--- Select ---', 'label' => 'Ex-serviceman', 'attr' => ['required'], 'wrapper' => ['class' => 'form-group-sm col-md-3']]);
     $this->add('physical_challenge', 'select', ['choices' => ['YES' => 'YES', 'NO' => 'NO'], 'empty_value' => '--- Select ---', 'label' => 'Physically Challenged', 'attr' => ['required'], 'wrapper' => ['class' => 'form-group-sm col-md-3']]);
     $this->add('physical_height', 'text', ['attr' => ['maxlength' => '5', 'placeholder' => 'height in cm'], 'label' => 'Physical height', 'wrapper' => ['class' => 'form-group-sm col-md-4']]);
     $this->add('physical_weight', 'text', ['attr' => ['maxlength' => '5', 'placeholder' => 'weight in k.g.'], 'label' => 'Physical weight', 'wrapper' => ['class' => 'form-group-sm col-md-4']]);
     $this->add('physical_chest', 'text', ['attr' => ['maxlength' => '5', 'placeholder' => ' in cm'], 'label' => 'Physical Chest', 'wrapper' => ['class' => 'form-group-sm col-md-4']]);
     $this->add('description', 'textarea', ['attr' => ['maxlength' => '255', 'rows' => '3', 'placeholder' => 'additional note/details of the job'], 'wrapper' => ['class' => 'form-group col-md-12']]);
     $this->add('Submit', 'submit', ['attr' => ['class' => 'btn btn-lg btn-primary col-md-12']]);
     $this->add('update', 'submit', ['attr' => ['class' => 'btn btn-lg btn-success col-md-12']]);
 }
 public function buildForm()
 {
     $this->add('fullname', 'text', ['attr' => ['required', 'maxlength' => '50', 'placeholder' => 'Full Name'], 'label' => 'Full Name :']);
     $this->add('guar_name', 'text', ['attr' => ['required', 'maxlength' => '50', 'placeholder' => 'Guardian Name'], 'label' => 'Father’s / Mother’s Name :']);
     $this->add('spouse_name', 'text', ['attr' => ['maxlength' => '50', 'placeholder' => 'Spouse Name'], 'label' => 'Spouse Name :']);
     $this->add('sex', 'select', ['choices' => CandidateInfo::$sex_options, 'empty_value' => '--- Select ---', 'label' => 'Sex :', 'attr' => ['required']]);
     $this->add('caste_id', 'select', ['choices' => Caste::lists('name', 'id')->all(), 'empty_value' => '--- Select ---', 'label' => 'Caste :', 'attr' => ['required']]);
     $this->add('religion', 'select', ['choices' => CandidateInfo::$religion_options, 'empty_value' => '--- Select ---', 'label' => 'Religion :', 'attr' => ['required']]);
     $this->add('marital_status', 'select', ['choices' => CandidateInfo::$marital_status_options, 'empty_value' => '--- Select ---', 'label' => 'Marital Status :', 'attr' => ['required']]);
     $this->add('dob', 'text', ['attr' => ['required', 'maxlength' => '50', 'placeholder' => 'DD-MM-YYYY', 'class' => 'form-control _date', 'readonly'], 'label' => 'Date of birth:']);
     $this->add('physical_challenge', 'select', ['choices' => ['YES' => 'YES', 'NO' => 'NO'], 'empty_value' => '--- Select ---', 'label' => 'Physically Challenged', 'attr' => ['required']]);
     $this->add('ex_service', 'select', ['choices' => ['YES' => 'YES', 'NO' => 'NO'], 'empty_value' => '--- Select ---', 'label' => 'Whether Ex-serviceman', 'attr' => ['required']]);
     $this->add('address', 'textarea', ['attr' => ['maxlength' => '255', 'rows' => '5', 'placeholder' => 'Address details'], 'label' => 'Address']);
     //$states = State::lists('name', 'id')->all();
     $this->add('state_id', 'select', ['choices' => ['3' => 'Arunachal Pradesh (AR)'], 'label' => 'State', 'attr' => ['required']]);
     $districts = District::lists('name', 'id')->all();
     $this->add('district_id', 'select', ['choices' => $districts, 'empty_value' => '--- Select ---', 'label' => 'District', 'attr' => ['required']]);
     $this->add('pincode', 'text', ['attr' => ['required', 'maxlength' => '6', 'placeholder' => 'Pincode'], 'label' => 'Pincode']);
     $this->add('physical_height', 'text', ['attr' => ['maxlength' => '5', 'placeholder' => 'height in cm'], 'label' => 'Physical height']);
     $this->add('physical_weight', 'text', ['attr' => ['maxlength' => '5', 'placeholder' => 'weight in k.g.'], 'label' => 'Physical weight']);
     $this->add('physical_chest', 'text', ['attr' => ['maxlength' => '5', 'placeholder' => ' in cm'], 'label' => 'Physical Chest']);
     $this->add('photo_url', 'file', ['attr' => ['id' => 'photo_url', 'accept' => '.jpg, .png', 'required', 'title' => 'Please upload a passport size photograph'], 'label' => 'Passport Photo']);
     $this->add('cv_url', 'file', ['attr' => ['id' => 'cv_url', 'accept' => '.doc, .docx, .pdf', 'required', 'title' => 'Please upload our RESUME'], 'label' => 'CV :']);
     $proof_details = MasterProof::lists('name', 'id')->all();
     $this->add('proof_details_id', 'select', ['choices' => $proof_details, 'empty_value' => '--- Select ---', 'label' => 'Proof of Residence :', 'attr' => ['required']]);
     $this->add('proof_no', 'text', ['attr' => ['maxlength' => '100', 'placeholder' => 'Proof/Id No ', 'required'], 'label' => 'Proof/Id No: ']);
     $this->add('relocated', 'select', ['choices' => CandidateInfo::$relocated_options, 'empty_value' => '--- Select ---', 'label' => 'Willing to Relocate :', 'attr' => ['required']]);
     $this->add('bpl', 'select', ['choices' => ['YES' => 'YES', 'NO' => 'NO'], 'empty_value' => '--- Select ---', 'label' => 'Whether BPL :', 'attr' => ['required']]);
     $this->add('adhaar_no', 'text', ['attr' => ['maxlength' => '100', 'placeholder' => 'Aadhaar No '], 'label' => 'Aadhaar No: ']);
     $this->add('additional_info', 'textarea', ['attr' => ['maxlength' => '255', 'rows' => '5', 'placeholder' => ''], 'label' => 'Additional Information :']);
     // $table->string('additional_info
     // $table->string('photo_url', 200)->nullable()->comment('Photo URL');
     // $table->string('cv_url', 200)->nullable()->comment('CV URL');
     $this->add('save', 'submit', ['attr' => ['class' => 'btn btn-default btn-blue btn-lg']]);
     $this->add('update', 'submit', ['attr' => ['class' => 'my_button']]);
 }