public function showboothAjax()
 {
     //log out from last booth
     if (Session::has('booth_id')) {
         $boothId = Session::get('booth_id');
         $systemtrackId = Session::get('systemtrack_booth_id');
         $systemtrack = Systemtrack::find($systemtrackId);
         $systemtrack->leave_at = date("Y-m-d H:i:s");
         $systemtrack->save();
         Session::forget('booth_id');
         // Session::forget('systemtrack_id');
     }
     $boothId = Request::get('boothId');
     $booth = Booth::find($boothId);
     $systemtrack = new Systemtrack();
     $systemtrack->user_id = Auth::User()->id;
     $systemtrack->spot_id = $booth->spot_id;
     $systemtrack->do = Auth::User()->name . ' ' . 'visit' . ' ' . $booth->name . ' Booth ' . 'at' . ' ' . date("Y-m-d H:i:s");
     $systemtrack->comein_at = date("Y-m-d H:i:s");
     $systemtrack->type = 'booth';
     $systemtrack->type_id = $boothId;
     $systemtrack->save();
     Session::put('booth_id', $boothId);
     Session::put('systemtrack_booth_id', $systemtrack->id);
     // echo json_encode($booth);
     //echo "yarab far7a";
     $result = $booth;
     $result2 = $booth->exhibitor->name;
     echo json_encode(array("value" => $result, "value2" => $result2));
 }
 /**
  * function ajax for showing booths
  * @param  integer $user_id
  * @return Response
  */
 public function showboothAjax()
 {
     //log out from last booth
     if (Session::has('booth_id')) {
         $boothId = Session::get('booth_id');
         $systemtrackId = Session::get('systemtrack_booth_id');
         $systemtrack = Systemtrack::find($systemtrackId);
         $systemtrack->leave_at = date("Y-m-d H:i:s");
         $systemtrack->save();
         Session::forget('booth_id');
         // Session::forget('systemtrack_id');
     }
     //check on event_id is exsist
     //log out from last booth
     if (Session::has('systemtrack_event_id')) {
         $systemtrack_event_id_value = Session::get('systemtrack_event_id');
         $systemtrack_event = Systemtrack::find($systemtrack_event_id_value);
         if ($systemtrack_event->leave_at == null) {
             DB::table('systemtracks')->where('id', $systemtrack_event_id_value)->update(['leave_at' => date("Y-m-d H:i:s")]);
             //$systemtrack_booth->leave_at=date("Y-m-d H:i:s");
         }
     }
     $boothId = Request::get('boothId');
     $booth = Booth::find($boothId);
     $systemtrack = new Systemtrack();
     $systemtrack->user_id = Auth::User()->id;
     $systemtrack->spot_id = $booth->spot_id;
     $systemtrack->do = Auth::User()->name . ' ' . 'visit' . ' ' . $booth->name . ' Booth ' . 'at' . ' ' . date("Y-m-d H:i:s");
     $systemtrack->comein_at = date("Y-m-d H:i:s");
     $systemtrack->type = 'booth';
     $systemtrack->type_id = $boothId;
     $systemtrack->save();
     Session::put('booth_id', $boothId);
     Session::put('systemtrack_booth_id', $systemtrack->id);
     DB::table('systemtracks')->where('id', $systemtrack->id)->update(['boothid' => $id, 'systemboothid' => $systemtrack->id]);
     // echo json_encode($booth);
     //echo "yarab far7a";
     $result = $booth;
     $result2 = $booth->exhibitor->name;
     echo json_encode(array("value" => $result, "value2" => $result2));
 }
 public function listbooths($id)
 {
     $booths = Booth::where('exhibition_event_id', $id)->get();
     $systemtrack = new Systemtrack();
     $systemtrack->user_id = Auth::User()->id;
     //  $systemtrack->spot_id=$booth->spot_id;
     $systemtrack->do = Auth::User()->name . ' ' . 'visit' . ' ' . $booths[0]->exhibition_event->name . ' Event ' . 'at' . ' ' . date("Y-m-d H:i:s");
     $systemtrack->comein_at = date("Y-m-d H:i:s");
     $systemtrack->type = 'exhibitionevent';
     $systemtrack->type_id = $id;
     $systemtrack->save();
     //save  exhibition event id  in session
     Session::put('event_id', $id);
     Session::put('systemtrack_event_id', $systemtrack->id);
     return view('VisitorCP.exhibitionevents.listbooths', compact('booths'));
 }
 /**
  * function to show event in certain page
  *
  * @param  int  $id
  * @return Response
  */
 public function showEventPage($id)
 {
     //check on event_id is exsist
     if (Session::has('systemtrack_event_id')) {
         $systemtrack_event_id_value = Session::get('systemtrack_event_id');
         $systemtrack_event = Systemtrack::find($systemtrack_event_id_value);
         if ($systemtrack_event->leave_at == null) {
             DB::table('systemtracks')->where('id', $systemtrack_event_id_value)->update(['leave_at' => date("Y-m-d H:i:s")]);
             //$systemtrack_booth->leave_at=date("Y-m-d H:i:s");
         }
     }
     //check on booth_id is exsist
     if (Session::has('systemtrack_booth_id')) {
         $systemtrackid = Systemtrack::all()->last()->pluck('id');
         $systemtrack_booth_id_value = Session::get('systemtrack_booth_id');
         $systemtrack_booth = Systemtrack::find($systemtrack_booth_id_value);
         if ($systemtrack_booth->leave_at == null) {
             DB::table('systemtracks')->where('id', $systemtrack_booth_id_value)->update(['leave_at' => date("Y-m-d H:i:s")]);
             //$systemtrack_booth->leave_at=date("Y-m-d H:i:s");
         }
     }
     $exhibitionevent = ExhibitionEvent::find($id);
     $booths = Booth::where('exhibition_event_id', $id)->get();
     $systemtrack = new Systemtrack();
     $systemtrack->user_id = Auth::User()->id;
     //  $systemtrack->spot_id=$booth->spot_id;
     $systemtrack->do = Auth::User()->name . ' ' . 'visit' . ' ' . $exhibitionevent->name . ' Event ' . 'at' . ' ' . date("Y-m-d H:i:s");
     $systemtrack->comein_at = date("Y-m-d H:i:s");
     $systemtrack->type = 'exhibitionevent';
     $systemtrack->type_id = $id;
     $systemtrack->save();
     //save  exhibition event id  in session
     Session::put('event_id', $id);
     Session::put('systemtrack_event_id', $systemtrack->id);
     DB::table('systemtracks')->where('id', $systemtrack->id)->update(['eventid' => $id, 'systemeventid' => $systemtrack->id]);
     return view('exhibitionevents.eventpage', compact('exhibitionevent', 'booths'));
 }