Esempio n. 1
0
 public function hasErrors()
 {
     return $this->errors->count() > 0;
 }
Esempio n. 2
0
 public function postApply()
 {
     $data = Input::all();
     $user = Sentry::getUser();
     $student = StudentInfo::find($user->id);
     $job = Job::findOrFail($data["job_id"]);
     $errors = new \Illuminate\Support\MessageBag();
     if (!$job->isOpen()) {
         $errors->add("job_not_open", "not open");
     }
     if (!$job->VerfiyCertificates($student)) {
         $errors->add("student_certificates", "does not have necessary certificates");
     }
     if ($student->isGraduate()) {
         $errors->add("student_graduated", "Student graduated");
     }
     if ($job->isAwarded() > 0) {
         $errors->add("student_applied", "already Applied");
     }
     if ($errors->count() > 0) {
         return Redirect::back()->withErrors($errors);
     }
     $jobApplication = JobApplicant::create(array("job_id" => $job->id, "user_id" => $user->id, "job_applicant_status_id" => JobApplicantStatus::$APPLIED));
     $jobApplication->LogStatus($user->id);
     $employer = $job->employer;
     $applicant = $jobApplication->studentInfo;
     Mail::send('emails.jobs.new_applicant', compact('applicant', 'job'), function ($message) use($employer, $job) {
         $message->from('*****@*****.**', 'QuadJobs');
         $message->to($employer->email, $employer->first_name . ' ' . $employer->last_name);
         $message->subject("There's a new student interested in your job posting");
     });
     return Redirect::action("JobApplicantsController@anyThankYou");
 }