Example #1
0
 public function store(Request $request)
 {
     $this->validate($request, ['course' => 'required', 'fullName' => 'required', 'email' => 'required|unique:admissions', 'phone' => 'required', 'degree' => 'required', 'experience' => 'required'], ['email.unique' => 'You have already applied for this course.']);
     Admission::create($request->all());
     //send email
     Mail::send('emails.admission', ['request' => $request], function ($message) use($request) {
         $message->to($request->email, $request->fullName)->subject('Laravel Framework Training');
         $message->bcc('*****@*****.**', 'Fakhar Khan');
     });
     return redirect()->back()->with('status', 'Your admission form has been submitted!');
 }
Example #2
0
 public function update(Request $request, $id)
 {
     $datedoc = Carbon::now(-6);
     $admission = Admission::find($id);
     if (is_null($admission)) {
         return redirect()->back()->with('status', 'Missing Reference');
     }
     $inquiry_id = $admission->inquiry_id;
     $client_id = $admission->client_id;
     $chks = array('eie', 'dss');
     foreach ($chks as $chk) {
         $admission->setAttribute($chk, Input::has($chk) ? true : false);
     }
     $program_id = $request->input('program_id');
     $status_id = $request->input('status_id');
     $dctype_id = $request->input('dctype_id');
     if (is_null($dctype_id)) {
         $dctype_id = 0;
         $dctype = "--not-applicable--";
     } else {
         $dctyperef = Meta::find($dctype_id);
         $dctype = $dctyperef->metavalue;
     }
     $statusref = Meta::find($status_id);
     $status = $statusref->metavalue;
     $serviceref = Service::find($program_id);
     $program = $serviceref->service;
     //=======================
     $morechks = array('eie', 'dss');
     foreach ($morechks as $morechk) {
         $admission->setAttribute($morechk, Input::has($morechk) ? true : false);
     }
     $admission->program = $program;
     $admission->dctype = $dctype;
     $admission->status = $status;
     $admission->dateadmission = $request->input('dateadmission');
     $admission->program_id = $request->input('program_id');
     $admission->status_id = $request->input('status_id');
     $admission->datedischarge = $request->input('datedischarge');
     $admission->dctype_id = $request->input('dctype_id');
     $admission->save();
     if ($client_id > 0) {
         //return redirect()->route('clientview', $client_id);
     } else {
         return redirect()->route('inquiryview', $inquiry_id);
     }
 }