コード例 #1
0
 public function edit_help($user)
 {
     switch ($user->type) {
         case 'customer':
             Customer::where('id', '=', $user->id)->delete();
             break;
         case 'driver':
             Driver::where('id', '=', $user->id)->delete();
             break;
         case 'business':
             Business::where('id', '=', $user->id)->delete();
             break;
         default:
             break;
     }
     $user->type = Input::get('type');
     $user->save();
     switch (Input::get('type')) {
         case 'driver':
             $driver = new Driver();
             $driver->id = $user->id;
             $driver->first_name = Input::get('first_name');
             $driver->last_name = Input::get('last_name');
             $driver->phone = Input::get('phone');
             $driver->home_address = Input::get('address');
             $driver->credit_card = Input::get('credit_card');
             $driver->cvv = Input::get('cvv');
             $driver->expiry_date = Input::get('expiry_date');
             $driver->car_type = Input::get('car_type');
             $driver->cab_no = Input::get('cab_no');
             $driver->flag = Input::get('flag');
             $driver->rate = Input::get('rate');
             $driver->hour = Input::get('hour');
             $driver->save();
             break;
         case 'customer':
             $customer = new Customer();
             $customer->id = $user->id;
             $customer->first_name = Input::get('first_name');
             $customer->last_name = Input::get('last_name');
             $customer->phone = Input::get('phone');
             $customer->home_address = Input::get('address');
             $customer->credit_card = Input::get('credit_card');
             $customer->cvv = Input::get('cvv');
             $customer->expiry_date = Input::get('expiry_date');
             $customer->save();
             break;
         case 'business':
             $business = new Business();
             $business->id = $user->id;
             $business->business_name = Input::get('business_name');
             $business->phone = Input::get('phone');
             $business->home_address = Input::get('address');
             $business->credit_card = Input::get('credit_card');
             $business->cvv = Input::get('cvv');
             $business->expiry_date = Input::get('expiry_date');
             $business->save();
             break;
     }
 }
コード例 #2
0
ファイル: Business.php プロジェクト: jnicolasbc/admin_swp_com
 public static function doctorNegocios()
 {
     $user = Sentry::getUser();
     $doctors = Doctor::where('user_id', $user->id)->first();
     $business = Business::where('doctor_id', $doctors->id)->get();
     if ($business) {
         return $business;
     } else {
         return false;
     }
 }
コード例 #3
0
 public function getGeolocationFixer($business_id)
 {
     $parsed_location = str_replace(" ", "+", Business::localAddress($business_id));
     $data = json_decode(file_get_contents('https://maps.googleapis.com/maps/api/geocode/json?address=' . $parsed_location));
     Business::where('business_id', '=', $business_id)->update(array('longitude' => $data->results[0]->geometry->location->lng, 'latitude' => $data->results[0]->geometry->location->lat));
     echo 'Coordinates set.';
 }
コード例 #4
0
 public function getDoctorAgenda($id)
 {
     if (Payment::VeryPayment() == false) {
         return View::make('clinic.payment.renews-payment');
     }
     $agenda = Agenda::where('doctor_id', $id)->first();
     $dt = Carbon::now();
     $bussi = Business::where('agenda_id', $agenda->id)->first()->id;
     if ($dt->dayOfWeek == 0) {
         $dia = 'Sunday';
     } elseif ($dt->dayOfWeek == 1) {
         $dia = 'Monday';
     } elseif ($dt->dayOfWeek == 2) {
         $dia = 'Tuesday';
     } elseif ($dt->dayOfWeek == 3) {
         $dia = 'Wednesday';
     } elseif ($dt->dayOfWeek == 4) {
         $dia = 'Thursday';
     } elseif ($dt->dayOfWeek == 5) {
         $dia = 'Friday';
     } else {
         $dia = 'Saturday';
     }
     $CustomDay = CustomDay::where('agenda_id', $agenda->id)->get();
     $Configday = Configday::where('day', $dia)->where('agenda_id', $agenda->id)->first();
     $AgendaAppo = Appointment::where('agenda_id', $agenda->id)->get();
     return View::make('clinic.doctors.Appointments')->with('agendaAppo', $AgendaAppo)->with('configday', $Configday)->with('customddays', $CustomDay)->with('bussi', $bussi)->with('agenda', $agenda);
 }
コード例 #5
0
 public function getByType($type1, $type2)
 {
     $businesses = Business::where('type', '=', $type1)->orWhere('type', '=', $type2)->get();
     return Response::json($businesses);
 }
コード例 #6
0
 /**
  * @author ARA
  * @param $facebook_id
  * @param $business_id
  * @param $message
  * @param null $phone
  * @return mixed
  * send message to business
  */
 public function getSendtoBusiness($facebook_id, $business_id, $message, $phone = null)
 {
     $user = User::where('fb_id', '=', $facebook_id)->select('email', 'first_name', 'last_name')->first();
     if ($user) {
         $name = $user->first_name . ' ' . $user->last_name;
         $email = $user->email;
         $timestamp = time();
         $attachment = '';
         $business = Business::where('business_id', '=', $business_id)->first();
         if ($business) {
             $thread_key = Message::threadKeyGenerator($business_id, $email);
             if (!Message::checkThreadByKey($thread_key)) {
                 $phones[] = $phone;
                 Message::createThread(array('contactname' => $name, 'business_id' => $business_id, 'email' => $email, 'phone' => serialize($phones), 'thread_key' => $thread_key));
                 $data = json_encode(array(array('timestamp' => $timestamp, 'contmessage' => $message, 'attachment' => $attachment, 'sender' => 'user')));
             } else {
                 $phones = unserialize(Message::getPhoneByKey($thread_key));
                 if (!is_array($phones)) {
                     $phones = array($phones);
                 }
                 if (!in_array($phone, $phones)) {
                     $phones[] = $phone;
                 }
                 Message::updateThread(array('phone' => serialize($phones)), $thread_key);
                 $data = json_decode(file_get_contents(public_path() . '/json/messages/' . $thread_key . '.json'));
                 $data[] = array('timestamp' => $timestamp, 'contmessage' => $message, 'attachment' => $attachment, 'sender' => 'user');
                 $data = json_encode($data);
             }
             file_put_contents(public_path() . '/json/messages/' . $thread_key . '.json', $data);
         } else {
             return Response::json(['error' => 'Business does not exist'], 200, array(), JSON_PRETTY_PRINT);
         }
     } else {
         return Response::json(['error' => 'User is not registered'], 200, array(), JSON_PRETTY_PRINT);
     }
     return Response::json(['success' => 1], 200, array(), JSON_PRETTY_PRINT);
 }