public function verifyEmployer($id) { $decoded = Hashids::decode($id); $id = $decoded[0]; //$employer = Employer::find($id)->first(); try { $employer = Employer::findOrFail($id); $employer->enrollment_no = str_replace('TMP_', '', $employer->temp_enrollment_no); $employer->temp_enrollment_no = null; $employer->verified_by = Auth::admin()->get()->id; if ($employer->save()) { return redirect()->back()->with('message', 'The Employer ' . $employer->organization_name . ' has been Approved Successfully'); } else { return redirect()->back()->with('message', 'Unable to process your request. Please try again'); } } catch (ModelNotFoundException $e) { //dd(get_class_methods($e)) // lists all available methods for exception object //dd($e) return redirect()->back()->with('message', 'The employer has not found!. 404'); } }
public function updateProfile(Request $request) { $rules = ['photo' => 'mimes:jpeg,png|max:512', 'organization_name' => 'required|max:255', 'tagline' => 'max:100', 'web_address' => 'url|max:255', 'details' => 'required|max:500']; $validator = Validator::make($data = $request->all(), $rules); if ($validator->fails()) { return Redirect::back()->withErrors($validator)->withInput(); } $model = Employer::findOrFail(Auth::employer()->get()->id); $destination_path = public_path('uploads/employers/'); if ($request->hasFile('photo')) { if ($request->file('photo')->isValid()) { $fileName = $model->id . '.' . $request->file('photo')->getClientOriginalExtension(); $request->file('photo')->move($destination_path, $fileName); //$data['cv_url'] = 'candidates/'.$candidate->id.'/'.$fileName; $data['photo'] = 'uploads/employers/' . $fileName; } } $model->update($data); return Redirect::route($this->route . 'profile')->with('alert-success', 'Profile has been Updated!'); }