protected function insert_schedules()
 {
     $doctors = Doctor::all();
     foreach ($doctors as $doctor) {
         $count = rand(300, 500);
         while ($count--) {
             $date = $this->get_random_date();
             $schedules = Schedule::where('date', $date)->where('doctor_id', $doctor->id)->get();
             if ($schedules->count()) {
                 continue;
             }
             // 添加早上排班
             if (rand(0, 1)) {
                 Schedule::create(['date' => $date, 'period' => 0, 'doctor_id' => $doctor->id]);
             }
             // 添加下午排班
             if (rand(0, 1)) {
                 Schedule::create(['date' => $date, 'period' => 1, 'doctor_id' => $doctor->id]);
             }
         }
     }
 }
 public function doctores()
 {
     $doctores = Doctor::all();
     return View::make('front.doctores')->with(compact('doctores'));
 }
Exemple #3
0
<?php

include 'routes/public.php';
Route::group(['prefix' => 'api'], function () {
    include 'routes/api.php';
});
App::missing(function ($exception) {
    return Response::unauthorized();
});
Route::get('/api/search/doctors', 'DoctorController@search');
Route::get('/api/specializations', 'DoctorController@showAllSpecializations');
Route::post('/auth/doctor/signup', 'DoctorController@signup');
Route::post('/auth/doctor/login', 'DoctorController@login');
Route::get('/api/clinic/{id}', 'ClinicController@show');
Route::get('/api/clinics', 'ClinicController@index');
Route::post('/api/appointment', 'AppointmentController@makeAppointment');
Route::post('/api/appointment/verify', 'AppointmentController@verifyAppointment');
Route::get('/seealldocs', function () {
    return Response::json(['doctors' => Doctor::all()]);
});
 public function index()
 {
     $doctores = Doctor::all();
     return View::make('admin.doctores')->with(compact('doctores'));
 }