/** * 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 test_save_modified_schedule_in_db() { $companyOne = factory(Company::class)->create(); // remove reminders for Company One $scheduleRepository = new ScheduleRepository(); $scheduleRepository->removeAllForObject($companyOne); $schedule = new Schedule(['run_at' => '2015-03-15', 'action' => ActionCommandSendReminderEmailCommand::class, 'who_object' => Company::class, 'who_id' => $companyOne->id, 'parameters' => json_encode(array()), 'status' => 'new']); $schedule->save(); $this->seeInDatabase('schedules', ['run_at' => '2015-03-15']); }
/** * Run the database seeds. * * @return void */ public function run() { DB::table('schedules')->delete(); $schedule = new Schedule(['eqpId' => '1', 'docId' => '2001', 'time' => '14']); $schedule->save(); $schedule = new Schedule(['eqpId' => '2', 'docId' => '2002', 'time' => '16']); $schedule->save(); $schedule = new Schedule(['eqpId' => '3', 'docId' => '2003', 'time' => '15']); $schedule->save(); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $faculty_id = Auth::user()->id; $schedulelist = Schedule::where('faculty_id', '=', $faculty_id)->get(); dd($schedulelist); return view('auth.availability')->with('availlist', $schedulelist); }
public function book($schedule_id) { $data = []; $data['article'] = ArticleCategory::with('articles')->get(); $data['schedule'] = Schedule::with('doctor', 'clinic')->where('id', $schedule_id)->first(); return view('frontend.pages.reservation.book', compact('data')); }
/** * @param Schedule $schedule */ public function saved(Schedule $schedule) { $state_ids = [$schedule->state_id]; $original_state_id = $schedule->getOriginal('state_id'); if ($original_state_id && $original_state_id != $schedule->state_id) { $state_ids[] = $original_state_id; } $stale_files = ['course-schedule-' . $schedule->course_id]; $states = State::whereIn('id', $state_ids)->get(); foreach ($states as $state) { $stale_files[] = 'state-schedule-' . $state->code; } $cache_path = public_path() . '/js/cache'; foreach ($stale_files as $stale_file) { File::delete($cache_path . DIRECTORY_SEPARATOR . $stale_file . '.js'); } }
/** * Run the database seeds. * Run at terminal: * $ php artisan db:seed --class=ReservationDummySeeder * * @return void */ public function run() { \App\Schedule::create(['clinic_id' => 1, 'doctor_id' => 1, 'schedule_start' => '08:00:00', 'schedule_end' => '18:00:00', 'date' => date("Y-m-d", strtotime("+2 day")), 'quota' => 0, 'status_batal' => 0]); \App\Schedule::create(['clinic_id' => 2, 'doctor_id' => 1, 'schedule_start' => '08:00:00', 'schedule_end' => '18:00:00', 'date' => date("Y-m-d"), 'quota' => 10, 'status_batal' => 0]); \App\Schedule::create(['clinic_id' => 1, 'doctor_id' => 1, 'schedule_start' => '08:00:00', 'schedule_end' => '10:00:00', 'date' => date("Y-m-d", strtotime("+1 day")), 'quota' => 2, 'status_batal' => 1]); \App\Schedule::create(['clinic_id' => 1, 'doctor_id' => 1, 'schedule_start' => '13:00:00', 'schedule_end' => '18:00:00', 'date' => date("Y-m-d", strtotime("+1 day")), 'quota' => 5, 'status_batal' => 0]); \App\Clinic::create(['city_id' => 1, 'name' => 'RSU Haji', 'address' => 'Sukolilo', 'latitude' => '-7.265757', 'longitude' => '112.734146', 'telephone' => '081234567890', 'email' => '5345678']); \App\Clinic::create(['city_id' => 1, 'name' => 'RSAL', 'address' => 'Mayjend Sungkono', 'latitude' => '-7.265757', 'longitude' => '112.734146', 'telephone' => '081234567890', 'email' => '5345678']); }
public function storeSchedule(Request $request, $engineer_id) { //First we need to remove all the schedules //$objEngineer = Engineer::find($engineer_id); Schedule::where('engineer_id', $engineer_id)->delete(); foreach ($request->all() as $newObj) { Schedule::create($newObj); } return ["success" => true]; }
public function searchProfile($name) { $name = urldecode($name); $data = array(); $data['article'] = \App\ArticleCategory::with('articles')->get(); $data['content'] = \App\Doctor::where('name', 'like', '%' . $name . '%')->first(); if (empty($data['content'])) { return redirect()->route('home'); } $data['schedule'] = []; for ($i = 0; $i <= 7; $i++) { $data['schedule'][$i] = []; } $schedules = \App\Schedule::where('doctor_id', $data['content']->id)->whereBetween('date', array(date("Y-m-d"), date("Y-m-d", strtotime("+1 week"))))->orderBy('date', 'asc')->orderBy('schedule_start', 'asc')->get(); foreach ($schedules as $schedule) { $len = 60 * 60 * 24; $now = date("Y-m-d"); $tmp = $schedule->date; if ((strtotime($tmp) - strtotime($now)) / $len == 0) { array_push($data['schedule'][0], $schedule); } else { if ((strtotime($tmp) - strtotime($now)) / $len == 1) { array_push($data['schedule'][1], $schedule); } else { if ((strtotime($tmp) - strtotime($now)) / $len == 2) { array_push($data['schedule'][2], $schedule); } else { if ((strtotime($tmp) - strtotime($now)) / $len == 3) { array_push($data['schedule'][3], $schedule); } else { if ((strtotime($tmp) - strtotime($now)) / $len == 4) { array_push($data['schedule'][4], $schedule); } else { if ((strtotime($tmp) - strtotime($now)) / $len == 5) { array_push($data['schedule'][5], $schedule); } else { if ((strtotime($tmp) - strtotime($now)) / $len == 6) { array_push($data['schedule'][6], $schedule); } else { if ((strtotime($tmp) - strtotime($now)) / $len == 7) { array_push($data['schedule'][7], $schedule); } } } } } } } } } return view('frontend.pages.home.search-profile', compact('data')); }
public function removeuser() { $username = Input::get('selected_username'); $id = User::where('username', $username)->first()->id; $usercourses = Course_detail::where('offered_by', $username)->get(); foreach ($usercourses as $usercourse) { Schedule::where('course_code', $usercourse->id)->delete(); Time_table::where('course_code', $usercourse->id)->delete(); } Course_detail::where('offered_by', $username)->delete(); user_detail::where('id', $id)->delete(); User::where('username', $username)->delete(); return redirect('/home'); }
public function removecourse() { $course = Input::get('selectcoursecode'); $courseclasses = Course_detail::where('course_code', $course)->get(); foreach ($courseclasses as $courseclass) { //delete schedules data Schedule::where('course_code', $courseclass->id)->delete(); Time_table::where('course_code', $courseclass->id)->delete(); } //delete class data Course_detail::where('course_code', $course)->delete(); //delete own data Course::where('course_code', $course)->delete(); return view('layouts.removecourse')->with('deletemsg', 'Course Deleted'); }
/** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function create() { $user = User::where('id', Auth::user()->id)->first(); $disability_types = DisabilityType::whereNotIn('id', [1])->orderBy('description', 'ASC')->lists('description', 'id')->toArray(); $victim_types = VictimType::whereNotIn('id', [1])->orderBy('description', 'ASC')->lists('description', 'id')->toArray(); $black_communities = BlackCommunity::whereNotIn('id', [1])->orderBy('description', 'ASC')->lists('description', 'id')->toArray(); $indigenous_peoples = IndigenousPeople::whereNotIn('id', [1])->orderBy('description', 'ASC')->lists('description', 'id')->toArray(); $ethnic_groups = EthnicGroup::whereNotIn('id', [1])->orderBy('description', 'ASC')->lists('description', 'id')->toArray(); $credits = Credit::whereNotIn('id', [1])->orderBy('description', 'ASC')->lists('description', 'id')->toArray(); $schedules = Schedule::orderBy('description', 'ASC')->lists('description', 'id')->toArray(); $programs = Program::orderBy('description', 'ASC')->lists('description', 'id')->toArray(); $civil_states = CivilState::orderBy('description', 'ASC')->lists('description', 'id')->toArray(); $sexes = Sex::orderBy('description', 'ASC')->lists('description', 'id')->toArray(); $sexual_orientations = SexualOrientation::orderBy('description', 'ASC')->lists('description', 'id')->toArray(); return view('app.data_update.create', compact('sexes', 'sexual_orientations', 'civil_states', 'programs', 'schedules', 'credits', 'ethnic_groups', 'indigenous_peoples', 'black_communities', 'victim_types', 'disability_types', 'user')); }
public function getScheduleByTeam($id) { if (!is_numeric($id)) { return new Http\Response("Incorrect Team Id", 400); } $team = null; // Try and see if the integer exists in our DB try { $team = Team::findOrFail($id); } catch (ModelNotFoundException $e) { return new Http\Response("Incorrect Team Id", 400); } // Concatenate the city and team name for the query $teamName = $team->city . ' ' . $team->team_name; $schedule = Schedule::where('home_team', $teamName)->orWhere('away_team', $teamName)->get(); return new Http\Response($schedule, 200); }
/** * Просмотр одного подписчика, с возможностью редактирования * * @param $id * @return $this */ public function view($id) { $subscriber = Subscriber::get($id); if (!$subscriber) { abort(404); } $breaks = Schedule::getBreaksById($id); for ($i = 0; $i < count($breaks); $i++) { $breaks[$i]->start_date = Carbon::parse($breaks[$i]->start_date); if (!$breaks[$i]->end_date) { $breaks[$i]->end_date = null; continue; } $breaks[$i]->end_date = Carbon::parse($breaks[$i]->end_date); } return view('subscribers.view')->with('subscriber', $subscriber)->with('breaks', $breaks); }
public function removegroup() { $groupname = Input::get('selectgroup_name'); $groups = Group::where('group_name', $groupname)->get(); foreach ($groups as $group) { $offered_to = $group->group_code; $batchcourses = Course_detail::where('offered_to', $offered_to)->get(); foreach ($batchcourses as $batchcourse) { //delete schedules data Schedule::where('course_code', $batchcourse->id)->delete(); Time_table::where('course_code', $batchcourse->id)->delete(); } // delete class data Course_detail::where('offered_to', $offered_to)->delete(); } //delete the group Group::where('group_name', $groupname)->delete(); return view('layouts.removegroup')->with('deletemsg', 'group Deleted'); }
public function update($id, Request $request) { $validator = Validator::make($request->all(), ['startDate' => 'required', 'endDate' => 'required', 'startTime' => 'required|regex:/^[0-9]{2}:[0-9]{2}$/', 'endTime' => 'required|regex:/^[0-9]{2}:[0-9]{2}$/']); if ($validator->fails()) { Session::flash('breakUpdateError', 'Ошибка при обновлении перерыва'); return redirect()->back(); } $requestedStartDate = $request->input('startDate') . ' ' . trim($request->input('startTime')) . ':00'; $requestedEndDate = $request->input('endDate') . ' ' . trim($request->input('endTime')) . ':00'; $startDate = Carbon::createFromFormat('d.m.Y H:i:s', $requestedStartDate)->toDateTimeString(); $endDate = Carbon::createFromFormat('d.m.Y H:i:s', $requestedEndDate)->toDateTimeString(); if (Schedule::updateBreakById($id, $startDate, $endDate)) { Session::flash('breakUpdateSuccess', 'Обновлено'); return redirect()->back(); } else { Session::flash('breakUpdateError', 'Ошибка при обновлении перерыва'); return redirect()->back(); } }
/** * Display the specified resource. * * @param int $id * @return Response */ public function show($id) { $s = []; $s[] = Schedule::find($id); $newObj = []; if ($s) { foreach ($s as $i => $obj) { if (!$this->isPast($obj->date)) { $newObj[$i] = $obj->date; $obj->onTime = $this->isOnTime($obj->date, $obj->start, $obj->end); $newObj[$i] = $obj; } } $newObj = $newObj[0]; } else { $newObj = ["no_entries" => true]; } return $newObj; }
<th>SN</th> <th>Day</th> <th>Start Time</th> <th>End Time</th> <th>Select</th> </tr> </thead> <tbody> <?php $i = 1; while ($i < 7) { $class_code = $course . no2day($i); //echo $class_code."<br>"; $listschedules = Schedule::where('class_id', $class_code); ?> @if($listschedules->exists()) <?php $listschedules = $listschedules->first(); ?> <tr> <td>{{ $i }}</td> <td>{{ no2day($i) }}</td> <td> <?php $starttimename = "starttime" . no2day($i); $endtimename = "endtime" . no2day($i); $checkboxvalue = no2day($i); ?> {!! Form::number($starttimename, $listschedules->stime, ['step' => '1', 'min'=>'7', 'max'=>'16']) !!}
public function removedepartment() { $departcode = Input::get('selectdepartmentcode'); //delete schedules data $departcourses = Course_detail::where('department_code', $departcode)->get(); foreach ($departcourses as $departcourse) { Schedule::where('course_code', $departcourse->id)->delete(); Time_table::where('course_code', $departcourse->id)->delete(); } //Delete course details data Course_detail::where('department_code', $departcode)->delete(); //Delete groups data Group::where('department', $departcode)->delete(); //Delete user data $departusers = User_detail::where('department', $departcode)->get(); foreach ($departusers as $departuser) { if (User::where('id', $departuser->id)->first()->utype == 0) { User_detail::where('id', $departuser->id)->delete(); User::where('id', $departuser->id)->delete(); } } Department::where('code', $departcode)->delete(); return view('layouts.removedepartment')->with('deletemsg', 'Department Deleted'); }
public function cancel($id) { $schedule = Schedule::find($id); if ($schedule->status_batal == '0') { $schedule->update(['status_batal' => '1']); } else { if ($schedule->status_batal == '1') { $schedule->update(['status_batal' => '0']); } } Session::flash('success', "Jadwal dokter dibatalkan"); return redirect()->back(); }
public function getAll() { $schedules = Schedule::all(); return new Http\Response($schedules, 200); }
/** * Execute the command. * * @return void */ public function handle() { Schedule::where('start', '<=', Carbon::today()->toDateString())->delete(); }
public function getPeopleList() { if (Auth::check()) { $peoples = Schedule::where("pacient_id", "!=", "null")->orderBy('data_priem', 'DESC')->paginate(15); return view("peoples-list", ["data" => $peoples]); } }
public function destroy($roomId, $id) { $schedule = Schedule::find($id); $deleted = $schedule->delete(); return response()->json(array('error' => !$deleted, 'schedules' => $schedule->toArray()), $deleted ? 200 : 500); }
function main_func($name, $department) { $MAX_Classes = Department::where('code', $department->code)->first()->total_rooms; //Thana kawaye nashi file read yaye ta kha /*$inputData=CSV2Array($name);//CSV2Array is a function defined inside the file functions.php and this file returns an array $i=0; foreach($inputData as $temp){//this loop will unwrap the two layered array which was stored in previous variable $inputvariable by the function CSV2Array in functions.php ${"data".$i}=$temp;//Array ko array lai unwrap gari ra cha $i++; } $courseName=$data0; $start=$data1; $end=$data2; unset($courseName[0]);//unset array na 0th item of array ta hate yana bi unset($start[0]);//This chaye yanyu dhasa tho ma yata dhasa ASP algorithm le taye mau pani chau first pseudo class miss jui so tho object yu data kha unset($end[0]);//THisis for the first column of the csv file chaye choya tayu pani mile maju $courseName=arrangeArray($courseName);//tho arrangeArray userdefined function kha... thake yo 0th item maru ta hana milaya yana bi.... ie ..A[0] delete jui hanji so A[1] ta A[0] yana bi and A[2] ta A[1] and so on $start=arrangeArray($start); $end=arrangeArray($end); */ $scheduledata = Schedule::where('day', $name)->where('department_code', $department->code)->get(); $courseName = array(); $start = array(); $end = array(); foreach ($scheduledata as $schedule) { $courseName[count($courseName)] = $schedule->course_code; $start[count($start)] = $schedule->stime; $end[count($end)] = $schedule->etime; //array_push($courseName,$schedule->course_code); //array_push($start,$schedule->stime); //array_push($end,$schedule->etime); } //File read yayau pati sidhala //For initializing the objects.... i.e. one object for one class $classes = array(); $i = 1; foreach ($start as $a) { $foo = new myClass(); $foo->set_Data($a, $end[$i - 1], $courseName[$i - 1], $i); $i++; array_push($classes, $foo); } if (count($classes)) { echo "<h2>Routine for: " . $name . "</h2><br>"; echo "The classes mentioned below are the classes that you want to arrange for <strong>" . $name . "</strong> is as below."; printObject($classes, 0, $name, $department->code); CustSort($classes); //Sorting accourding to the start time //This is the addition of A0 object at the first $temp = new myClass(); $temp->set_Data(9999, 0, "A0", 0); array_unshift($classes, $temp); //array_unshift() inserts passed elements to the front of the array //End of the A0 object addition $i = 1; while (sizeof($classes) != 1) { ${"abc" . $i} = AC_Object($classes); //$abc.$i is the array which stores the object of the classes that is being taught in the room $classes = array_udiff($classes, ${"abc" . $i}, 'compare_objects'); //This will call the functions compare_objects defined in the function functions.php so in this case the remaining classes to be arranged is ordered back $classes = arrangeArray($classes); //This will arrange the items in an array. After the removal the array will empty on certain slots for eg if array element A[7] is arranged and now it empty this gap will be arranged by this function and the new sequential function will be arranged. $i++; } //end of while for room. $i--; //this is fdone for counting the nof rooms required for the class rookm. $number_of_classes = $i; if ($number_of_classes <= $MAX_Classes && $number_of_classes > 0) { echo "You will require " . $i . " rooms for arranging this no of classes."; } else { echo "This above schedule cant be operated with existing no of classes. You will either require " . ($i - $MAX_Classes) . " additional classes or reschedule the following classes"; } $a = 1; if ($i > $MAX_Classes) { while ($a <= $MAX_Classes) { echo "<br><strong>Room: " . $a . "</strong>"; printObject(${"abc" . $a}, $a, $name, $department->code); $a++; } } //end of if($i>3 if ($number_of_classes > $MAX_Classes) { echo "The schedule you wish to prepare cant be arranged with " . $MAX_Classes . " classes. Please try to arrange the following classes in the empty slot for this day."; } while ($a <= $i) { echo "<br><strong>Room: " . $a . "</strong>"; printObject(${"abc" . $a}, $a, $name, $department->code); $a++; } } //end of if(count) }
public static function storeSchedule($scheduleLogId, $diagDate, $diagTime) { $schedule = new Schedule(); $schedule->scheduleLogId = $scheduleLogId; $schedule->diagDate = $diagDate; $schedule->diagTime = $diagTime; $schedule->save(); }
<div class="span3" id="sidebar"> <div class="container-fluid"> <div class="row-fluid"> <div class="span14"> <div class="well sidebar-nav"> <li class="nav-header">Departments with active routine</li> <?php use App\Schedule; use App\Department; $routineval = 0; $departments = Department::orderby('code')->get(); foreach ($departments as $department) { $schedules = Schedule::where('department_code', $department->code); if ($schedules->exists()) { $routineval = 1; ?> <li><a href='home?depart=<?php echo $department->code; ?> '>{{ $department->code }}</a></li> <?php } } ?> @if($routineval == 0) <li>No Schedule added yet. </li> @endif </div><!--/.well --> </div><!--/span--> </div> </div>
/** * Register any other events for your application. * * @param \Illuminate\Contracts\Events\Dispatcher $events * @return void */ public function boot(DispatcherContract $events) { parent::boot($events); Schedule::observe(new ScheduleObserver()); }
public function getDoDelete($schedule_id) { # Get the schedule to be deleted $schedule = \App\Schedule::find($schedule_id); if (is_null($schedule)) { \Session::flash('flash_message', 'Schedule not found.'); return redirect('/schedules/'); } # Detach any activities that go with the schedule. if ($schedule->activities()) { $schedule->activities()->detach(); } # Delete the schedule. $schedule->delete(); # Done \Session::flash('flash_message', $schedule->name . ' was deleted.'); return redirect('/schedules/'); }
echo "<h1>Department: " . $department->code . "</h1><br>"; } foreach ($weekdays as $a) { //echo "<h2>Routine for: ".strtoupper($a)."</h2><br>"; main_func($a, $department); } echo "<br><br>"; } else { echo "<h1> Hello " . $username . " </h1>"; $totalschedules = count(Schedule::all()); $totaltimetables = count(Time_table::all()); if ($totalschedules > 0 && $totaltimetables != $totalschedules) { echo "<p> You have <strong><nu>new update(s)</nu></strong>. The following are departments that have been recently updated: </p><br>"; $departs = Department::orderby('code')->get(); foreach ($departs as $depart) { $schedulecount = count(Schedule::where('department_code', $depart->code)->get()); if ($schedulecount > 0) { $timetablecount = count(Time_table::where('department_code', $depart->code)->get()); if ($schedulecount != $timetablecount) { ?> <a href='home?depart=<?php echo $depart->code; ?> '> <nu>{{ $depart->code }} </nu></a> <?php } } } } else { echo "<p> The routines are all up to date. Please make sure you visit the page when any update has been recorded. </p><br>";