public function postLaravelLogin()
 {
     $post = json_decode(file_get_contents("php://input"));
     if (User::checkFBUser($post->fb_id) && !Auth::check()) {
         Auth::loginUsingId(User::getUserIdByFbId($post->fb_id));
         $success = 1;
     } else {
         $success = 0;
     }
     return json_encode(array('success' => $success));
 }
 /**
  * @param $facebook_id
  * @return JSON-formatted response of the business name, estimated time, people-in-queue and next number available .
  */
 public function getBusinessServiceDetails($facebook_id)
 {
     try {
         $user_id = User::getUserIdByFbId($facebook_id);
     } catch (Exception $e) {
         $user_id = null;
     }
     if ($user_id) {
         $business_id = UserBusiness::getBusinessIdByOwner($user_id);
         $business_name = Business::name($business_id);
         $estimated_time = Analytics::getWaitingTime($business_id);
         $service = Service::getFirstServiceOfBusiness($business_id);
         $remaining_queue_count = Analytics::getServiceRemainingCount($service->service_id);
         $next_available_number = ProcessQueue::nextNumber(ProcessQueue::lastNumberGiven($service->service_id), QueueSettings::numberStart($service->service_id), QueueSettings::numberLimit($service->service_id));
         $details = ['business_name' => $business_name, 'estimated_time' => $estimated_time, 'people_in_queue' => $remaining_queue_count, 'next_available_number' => $next_available_number];
         return Response::json($details, 200, array(), JSON_PRETTY_PRINT);
     } else {
         return json_encode(['error' => 'Something went wrong!']);
     }
 }