/** * Define the application's command schedule. * * @param \Illuminate\Console\Scheduling\Schedule $schedule * * @return void */ protected function schedule(Schedule $schedule) { $schedule->command('inspire')->hourly(); // 进入维护模式 $schedule->command('down')->evenInMaintenanceMode()->dailyAt('23:00'); //->when(function () {return true;});// // 更新用户等级 $schedule->call(function () { $registrations = Registration::where('state', 0)->where(function ($query) { $query->where('registration_date', Carbon::yesterday()->toDateString()); })->get(); foreach ($registrations as $registration) { $user = $registration->user; $user->credit_level -= 1; $user->save(); } })->evenInMaintenanceMode()->daily(); // // 重置rest_num $schedule->call(function () { $doctor_schedules = DocSchedule::where('state', 0)->where(function ($query) { $week = [1 => 'monday', 2 => 'tuesday', 3 => 'wednesday', 4 => 'thursday', 5 => 'friday', 6 => 'saturday', 7 => 'sunday']; $query->where('doctoring_date', $week[Carbon::today()->dayOfWeek]); })->get(); foreach ($doctor_schedules as $doctor_schedule) { $doctor_schedule->rest_num = $doctor_schedule->total_num; $doctor_schedule->save(); } })->evenInMaintenanceMode()->dailyAt('3:00'); // // 离开维护模式 $schedule->command('up')->evenInMaintenanceMode()->dailyAt('7:00'); // }
public function register() { $data = Input::all(); $rules = array('name' => 'min:2', 'email' => 'required|unique:registrations', 'course' => 'required', 'branch' => 'required', 'contact' => 'required', 'college' => 'required', 'year' => 'required'); $validator = Validator::make($data, $rules); if ($validator->fails()) { // send back to the page with the input data and errors return "Looks Like You Have Already Registeres With This Email ID"; } else { $last = Registration::all()->last(); if ($last == null) { $last = 1; } else { $last = $last->id; } $registrations = new Registration(); $registrations->name = $data['name']; $registrations->email = $data['email']; $registrations->course = $data['course']; $registrations->branch = $data['branch']; $registrations->contact = $data['contact']; $registrations->college = $data['college']; $registrations->year = $data['year']; $registrations->zeal_id = "zeal_onl_" . strval($last + 1); $registrations->save(); return strtoupper($registrations->zeal_id); } }
public function add($id) { // Es würede auch Funktionieren wenn ich ein Turnier erstelle und diesem Benutzer hinzufüge.. (bessere Lösung).. $userid = Auth::user()->id; $registration = new Registration(); $registration->tournament()->associate(Tournament::find($id)); $registration->user()->associate(User::find($userid)); $registration->save(); return $this->index($id); // methoden parameter request apramter }
public function saveRegistration($input) { $registration = new Registration(); $registration->player_first_name = $input['player_first_name']; $registration->player_last_name = $input['player_last_name']; $registration->guardian_names = $input['guardian_names']; $registration->player_birthdate = Carbon::parse($input['player_birthdate']); $registration->player_email = $input['player_email']; $registration->player_phone_number = $input['player_phone_number']; $registration->emergency_contact = $input['emergency_contact']; $registration->emergency_phone_number = $input['emergency_phone_number']; $registration->player_previous_team = $input['player_previous_team']; $registration->player_conflicts = $input['player_conflicts']; $registration->save(); return $registration; }
public function download(Request $request) { $id = $request->id; $registration = Registration::find($id); $pathToFile = base_path() . '/Upload/' . "{$registration->file_name}"; return response()->download($pathToFile); }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { $trainees = Registration::lists('english_name', 'id'); $courses = Course::lists('course_name', 'id'); $data = TraineeCourse::whereId($id)->firstOrFail(); return view('traineeCourse.edit', compact('trainees', 'courses', 'data')); }
public function store(Request $request) { // TODO: recent coursemajor must not match wil the current coursemajor $system = Api::systemValue(); $coursemajor = DB::table('tbl_coursemajor')->where('course', $request->course)->where('major', $request->major)->first(); $registration = new Registration(); $registration->coursemajor = $coursemajor->id; $registration->student = $request->student; $registration->academicterm = $system->currentacademicterm; $registration->status = 'P'; $registration->curriculum = Curriculum::getCurrentCurriculum($request->course, $request->major, $system); $registration->datecreated = date('Y-m-d'); $registration->save(); Session::flashdata('message', htmlAlert('Successfully Saved', 'success')); return redirect('shift_student'); }
public function store(CreateRegistrationRequest $request) { $data = $request->all(); // Make sure the birthdate is properly formatted $data['birthdate'] = date("Y-m-d", strtotime($data['birthdate'])); $registration = Registration::create($data); return response()->json(array(true)); }
public function show($registration_id) { // TODO: just show what change . previous value and current value // show the student id $registration = Registration::find($registration_id); $party = Party::find($registration->student); $data['firstname'] = $party->firstname; $data['lastname'] = $party->lastname; $data['middlename'] = $party->middlename; $data['id'] = $registration_id; return view('registrar.show_registration', $data); }
public function register_new_student(NewStudentRegRequest $request) { DB::transaction(function () { $party = new Party(); $party->firstname = $request->firstname; $party->lastname = $request->lastname; $party->middlename = $request->middlename; $party->sex = $request->gender; $party->placeofbirth = $request->pob; $party->dateofbirth = $request->dob; $party->mobilenumber = $request->contact; $party->religion = $request->religion; $party->emailaddress = $request->emailadd; $party->civilstatus = $request->maritalstatus; $party->legacyid = $this->system->laststudentid; $party->address1 = $request->mailing_add; // insert into party $party->save(); // get the inserted id $party_id = $party->id; // set the laststudentid $this->setLastStudentId(); $curriculum = Curriculum::getCurrentCurriculum($request->course, $request->major, $this->system); $coursemajor = DB::table('coursemajor')->where('course', $request->course)->where('major', $request->major)->first(); $registration = new ModelRegistration(); $registration->curriculum = $curriculum; $registration->student = $party_id; $registration->academicterm = $this->system->currentacademicterm; $registration->status = 'P'; $registration->date = date('Y-m-d'); $registration->coursemajor = $coursemajor->id; // insert into registration $registration->save(); DB::table('tbl_student')->insert(['id' => $party_id, 'fathername' => $request->father_name, 'fatherproffession' => $request->father_occupation, 'mothername' => $request->mother_name, 'motherproffession' => $request->mother_occupation]); DB::table('tbl_useraccess')->insert(['id' => $party_id, 'username' => $request->username, 'password' => password_hash($request->password, PASSWORD_BCRYPT)]); // TODO: insert into tbl_useroption }); Session::put('message', htmlAlert('Successfully Registered', 'success')); return back(); }
public function store(Request $request) { $messages = ['digits_between' => 'The :attribute must be :max digits.']; $v = Validator::make($request->all(), ['email1' => 'required|email', 'contact1' => 'required|integer|digits_between:10,10', 'name1' => 'required|string|max:255', 'college1' => 'required|string|max:255', 'email2' => 'required_with:contact2,name2,college2|email', 'name2' => 'required_with:contact2,email2,college2|string|max:255', 'contact2' => 'required_with:email2,name2,college2|integer|digits_between:10,10', 'college2' => 'required_with:contact2,email2,name2|string|max:255', 'email3' => 'required_with:contact3,name3,college3|email', 'name3' => 'required_with:contact3,email3,college3|string|max:255', 'contact3' => 'required_with:email3,name3,college3|integer|digits_between:10,10', 'college3' => 'required_with:contact3,email3,name3|string|max:255', 'email4' => 'required_with:contact4,name4,college4|email', 'name4' => 'required_with:contact4,email4,college4|string|max:255', 'contact4' => 'required_with:email4,name4,college4|integer|digits_between:10,10', 'college4' => 'required_with:contact4,email4,name4|string|max:255', 'abstract' => 'required|max:5000', 'file' => 'max:10240', 'g-recaptcha-response' => 'required|recaptcha'], $messages); //redirect to registration page with errors if there is any if ($v->fails()) { return redirect(action('HomeController@register'))->withErrors($v->errors())->withInput(); } $registration = new Registration(); $registration->email_1 = $request->email1; $registration->name_1 = $request->name1; $registration->contact_number_1 = $request->contact1; $registration->college_1 = $request->college1; $registration->email_2 = $request->email2; $registration->name_2 = $request->name2; $registration->contact_number_2 = $request->contact2; $registration->college_2 = $request->college2; $registration->email_3 = $request->email3; $registration->name_3 = $request->name3; $registration->contact_number_3 = $request->contact3; $registration->college_3 = $request->college3; $registration->email_4 = $request->email4; $registration->name_4 = $request->name4; $registration->contact_number_4 = $request->contact4; $registration->college_4 = $request->college4; $registration->abstract = $request->abstract; $registration->save(); if ($request->file) { $destinationPath = base_path() . '/Upload/'; // upload path $extension = $request->file('file')->getClientOriginalExtension(); // getting file extension $fileName = $registration->id . '.' . $extension; // renameing image $request->file('file')->move($destinationPath, $fileName); $registration->file_name = $fileName; $registration->save(); } return view('success'); }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $student = Auth::user(); $regs = Registration::where('student_id', '=', $student->id)->get(); if (count($regs) > 0) { Flash::error('You have completed registration!.'); return redirect()->route('registration'); } $courses = json_decode(stripslashes($request["courses_selected"])); $courses_unique = array_unique($courses); foreach ($courses_unique as $course) { Registration::create(['course_id' => $course, 'student_id' => $student->id]); } Flash::success('Registration complete.'); return redirect()->route('registration.index'); }
/** * Update the specified resource in storage. * * @param Request $request * @param int $id * @return Response */ public function update(Request $request, $id) { $registration = Registration::find($id); $postData = Input::all(); $messages = ['program.required' => 'Enter Program', 'specialty.required' => 'Enter Specialty', 'period.required' => 'Enter Period', 'user_id.required' => 'Enter User Id']; $rules = ['program' => 'required|integer|min:1|max:3', 'specialty' => 'required|integer|min:1|max:3', 'period' => 'required|integer|min:1|max:3', 'user_id' => 'required|integer|min:1']; $validator = Validator::make($postData, $rules, $messages); if ($validator->fails()) { // send back to the page with the input data and errors return Response::json(['Error' => ['message' => $validator->messages(), 'status_code' => 200]], 200); } else { // Do your stuff here. // send back to the page with success message return Response::json(['Success' => ['message' => 'Record Save Exits', 'status_code' => 200]], 200); } $registration->save(Input::all()); return "Sucess updating user #" . $registration->id; }
public function traineeHome() { $id = Auth::user()->id; $regId = Registration::where('user_id', '=', Auth::user()->id)->pluck('id'); $user_id = Auth::user()->id; $course_ids = TraineeCourse::where('trainee_id', $user_id)->select('course_id')->get(); //$course_ids=Info::where('trainee_login_id', $user_id)->get(); $courseAttendance = []; foreach ($course_ids as $course_id) { $course_name = $this->course_name_by_course_id($course_id->course_id); if (!$course_name->isempty()) { $absent = Attendance::where('course_id', $course_id->course_id)->where('trainee_id', $user_id)->where('trainee_attendance', '=', 'A')->count('id'); $courseAttendance[] = array('course_name' => $course_name, 'absent' => $absent); } } $info = Info::wheretrainee_login_id($user_id)->firstOrFail(); return view('trainee.trainee', compact('regId', 'courseAttendance', 'info')); //dd($regId); return view('trainee.trainee', compact('regId'))->with('id', $id); }
/** * Run the database seeds. * * @return void */ public function run() { $circles = Circle::all(); foreach ($circles as $circle) { $pupils = Pupil::where('schoolenrolment', $circle->year - $circle->grade + 1)->get(); $count = rand(0, min(10, $pupils->count())); if ($count == 0) { continue; } if ($count == 1) { $pupil = $pupils->random(); Registration::create(['circle_id' => $circle->id, 'pupil_id' => $pupil->id]); } else { $pupils = $pupils->random($count); foreach ($pupils as $pupil) { Registration::create(['circle_id' => $circle->id, 'pupil_id' => $pupil->id]); } } } }
public function show($id) { $common = $this->commonQuery(); $data['courses'] = $common['course']; $data['majors'] = $common['majors']; $data['religions'] = $common['religions']; $party = Party::find($id); //$student = DB::table('tbl_student')->where('id', $id)->get(); // get the latest registration $registration = Registration::student($id)->latest()->first(); $coursemajor = DB::table('tbl_coursemajor')->where('id', $registration->coursemajor)->first(); $data['id'] = $id; $data['firstname'] = $party->firstname; $data['lastname'] = $party->lastname; $data['middlename'] = $party->middlename; $data['gender'] = $party->sex; $data['maritalstatus'] = $party->civilstatus; $data['religion_student'] = $party->religion; $data['mail_add'] = $party->address1; $data['contact'] = $party->mobilenumber; $data['emailadd'] = $party->emailaddress; $data['update'] = 'yes this is a update'; return view('registrar.update_student_reg', $data); }
/** * 获取医生出诊时间 * * @param Request $request * @param Doctor $doctor * * @return string */ public function getSchedules(Request $request, Doctor $doctor) { $user_id = empty($request->user()) ? '' : $request->user()->id; $shedules = $doctor->schedules; foreach ($shedules as $schedule) { $schedule->ordered = Registration::where(['user_id' => $user_id, 'schedule_id' => $schedule->id, 'registration_date' => $schedule->doctoring_date])->count() > 0 ? 1 : 0; } return $shedules; }
/** * 打印预约单 * * @param Request $request * @param Registration $registration */ public function printInfo(Request $request, Registration $registration) { $user = $request->user(); if ($user->id != $registration->user_id) { return response()->json(['status' => 1, 'message' => '无权限']); } if ($registration->is_paid == 1) { if ($registration->deals()->count() != 1) { return response()->json(['status' => 4, 'message' => '数据异常']); } $schedule = Schedule::find($registration->schedule_id); $doctor = Doctor::find($schedule->doctor_id); $department = Department::find($doctor->department_id); $hospital = Hospital::find($department->hospital_id); $data = array('user_name' => $user->name, 'sex' => $user->sex, 'age' => $user->age, 'doctor' => $doctor->doctor_name, 'doctor_time' => $schedule->doctoring_time, 'doctor_data' => $schedule->doctoring_data, 'department' => $department->department_nam, 'hospital' => $hospital->hospital_name, 'fee' => $registration->fee, 'registration_time' => $registration->created_at); return $data; } else { return response()->json(['status' => 8, 'message' => '未付款,不能打印']); } }
public function index() { $registrations = Registration::get(); return view('admin.registrations.index', array('title' => 'Admin: Registrations', 'registrations' => $registrations)); }
public function register($event_slug) { $json['errors'] = []; $json['messages'] = []; $event = Event::where('slug', $event_slug)->where('verified', true)->first(); if (Session::has('id')) { $student = Student::where('id', Session::get('id'))->first(); if ($event) { if (Registration::where('student_id', Session::get('id'))->where('event_id', $event->id)->first()) { $json['errors'][] = "Already Registered"; } else { $round = $event->rounds->where('no', '1')->first(); $qualifier = new Qualifier(); $qualifier->save(); $round->qualifiers()->save($qualifier); $student->qualifiers()->save($qualifier); $registration = new Registration(); $registration->save(); $student->registrations()->save($registration); $event->registrations()->save($registration); $json['messages'][] = "successfull"; } } else { $json['errors'][] = "Event dont exist"; } } else { $json['errors'][] = "Please login to continue"; } return response()->json($json); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $department = Registration::find($id); $department->delete(); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function printdoc($id) { $inscription = Registration::findOrFail($id); //return view('registration.print', compact('inscription')); $view = \View::make('registration.print', compact('inscription'))->render(); $pdf = \App::make('dompdf.wrapper'); $pdf->loadHTML($view); return $pdf->stream('printdoc'); }
/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { return Registration::find($id)->toJson(); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function traineeHome() { $regId = Registration::where('user_id', '=', Auth::user()->id)->pluck('id'); //dd($regId); return view('trainee.trainee', compact('regId')); }
public function remove(Request $request) { $circle_id = $request->circle_id; $pupil_id = $request->pupil_id; Registration::where('circle_id', $circle_id)->where('pupil_id', $pupil_id)->delete(); }
/** * Show the application dashboard. * * @return \Illuminate\Http\Response */ public function index() { $latest_registrations = Registration::take(10)->orderBy('created_at', 'desc')->get(); $registrations = Registration::get(); return view('admin.index', array('title' => 'Admin: Dashboard', 'registrations_count' => $registrations && $registrations->count() > 0 ? $registrations->count() : 0, 'latest_registrations' => $latest_registrations)); }
public function store() { $registrations = Registration::get(); $mailchimp_creation_count = 0; $mailchimp_update_count = 0; $subscriber_creation_count = 0; foreach ($registrations as $registration) { // Athlete - first create the newsletter subscriber record if (!filter_var($registration->email, FILTER_VALIDATE_EMAIL) === false) { $athlete_subscriber = NewsletterSubscriber::where('email', '=', str_replace(" ", '', $registration->email))->first(); if (!$athlete_subscriber) { $athlete_subscriber = NewsletterSubscriber::create(array('registration_id' => $registration->id, 'first_name' => $registration->first_name, 'last_name' => $registration->last_name, 'email' => str_replace(" ", '', $registration->email))); $subscriber_creation_count++; } // Athlete - then officially add them to MailChimp if (WebsiteHelper::mailchimp_subscriber_exists($athlete_subscriber->email)) { Newsletter::updateMember($athlete_subscriber->email, array('FNAME' => $athlete_subscriber->first_name, 'LNAME' => $athlete_subscriber->last_name)); $mailchimp_update_count++; } else { Newsletter::subscribe($athlete_subscriber->email, array('FNAME' => $athlete_subscriber->first_name, 'LNAME' => $athlete_subscriber->last_name)); $mailchimp_creation_count++; } } if (!filter_var($registration->guardian_1_email, FILTER_VALIDATE_EMAIL) === false) { // Guardian 1 - first create the newsletter subscriber record $guardian_1_subscriber = NewsletterSubscriber::where('email', '=', str_replace(" ", '', $registration->guardian_1_email))->first(); if (!$guardian_1_subscriber) { $guardian_1_subscriber = NewsletterSubscriber::create(array('registration_id' => $registration->id, 'first_name' => $registration->guardian_1_first_name, 'last_name' => $registration->guardian_1_last_name, 'email' => str_replace(" ", '', $registration->guardian_1_email))); $subscriber_creation_count++; } // Guardian 1 - then officially add them to MailChimp if (WebsiteHelper::mailchimp_subscriber_exists($guardian_1_subscriber->email)) { Newsletter::updateMember($guardian_1_subscriber->email, array('FNAME' => $guardian_1_subscriber->first_name, 'LNAME' => $guardian_1_subscriber->last_name)); $mailchimp_update_count++; } else { Newsletter::subscribe($guardian_1_subscriber->email, array('FNAME' => $guardian_1_subscriber->first_name, 'LNAME' => $guardian_1_subscriber->last_name)); $mailchimp_creation_count++; } } // Only add the guardian 2 if they have an email present if (!filter_var($registration->guardian_2_email, FILTER_VALIDATE_EMAIL) === false) { $guardian_2_subscriber = NewsletterSubscriber::where('email', '=', str_replace(" ", '', $registration->guardian_2_email))->first(); if (!$guardian_2_subscriber) { // Guardian 2 - first create the newsletter subscriber record $guardian_2_subscriber = NewsletterSubscriber::create(array('registration_id' => $registration->id, 'first_name' => $registration->guardian_2_first_name, 'last_name' => $registration->guardian_2_last_name, 'email' => str_replace(" ", '', $registration->guardian_2_email))); $subscriber_creation_count++; } // Guardian 2 - then officially add them to MailChimp if (WebsiteHelper::mailchimp_subscriber_exists($guardian_2_subscriber->email)) { Newsletter::updateMember($guardian_2_subscriber->email, array('FNAME' => $guardian_2_subscriber->first_name, 'LNAME' => $guardian_2_subscriber->last_name)); $mailchimp_update_count++; } else { Newsletter::subscribe($guardian_2_subscriber->email, array('FNAME' => $guardian_2_subscriber->first_name, 'LNAME' => $guardian_2_subscriber->last_name)); $mailchimp_creation_count++; } } } if ($subscriber_creation_count > 0 || $mailchimp_creation_count > 0 || $mailchimp_update_count > 0) { \Flash::success("New Subscribers: " . $subscriber_creation_count . " New MailChimp Subscribers: " . $mailchimp_creation_count . " Updated MailChimp Subscribers: " . $mailchimp_update_count); } else { \Flash::error("Looks like there weren't any subscribers added!"); } return redirect()->back(); }