Example #1
0
 /**
  * Show the application dashboard to the user.
  *
  * @return Response
  */
 public function index(Route $route)
 {
     $upcomingexhibitionevents = ExhibitionEvent::where('start_time', '>', date("Y-m-d H:i:s"))->take(4)->get();
     $currentlyexhibitionevents = ExhibitionEvent::where('start_time', '<', date("Y-m-d H:i:s"))->where('end_time', '>', date("Y-m-d H:i:s"))->take(4)->get();
     $tracklogins = Tracklogin::where('user_id', '=', Auth::User()->id)->orderBy('created_at', 'desc')->take(2)->get();
     $systemtracks = Systemtrack::where('user_id', '=', Auth::User()->id)->orderBy('created_at', 'desc')->take(5)->get();
     if (Auth::User()->type == 'company') {
         $user = User::find(Auth::User()->id);
         $company = Company::where('user_id', $user->id)->get();
         $company = $company[0];
         $companyId = $company->id;
         $exhibitors = Exhibitor::where('company_id', $companyId)->get();
         //$booths=array();
         $events = array();
         $i = 0;
         foreach ($exhibitors as $exhibitor) {
             $booths = Booth::where('exhibitor_id', $exhibitor->id)->get();
             foreach ($booths as $booth) {
                 $events[$i] = $booth->exhibition_event_id;
                 $i++;
             }
         }
         $events = array_unique($events);
         //var_dump($events); exit();
         $i = 0;
         $exhibitionevents = array();
         foreach ($events as $event) {
             $exhibitionevents[$i] = ExhibitionEvent::find($event);
             $i++;
         }
         // var_dump($exhibitionevents[0]); exit();
         $upcomingcompanyevents = array();
         $currentlycompanyevents = array();
         $finishedcompanyevents = array();
         $i = 0;
         foreach ($exhibitionevents as $exhibitionevent) {
             if ($exhibitionevent->start_time > date("Y-m-d H:i:s")) {
                 $upcomingcompanyevents[$i] = $exhibitionevent;
                 $i++;
             } elseif ($exhibitionevent->start_time < date("Y-m-d H:i:s") && $exhibitionevent->end_time > date("Y-m-d H:i:s")) {
                 $currentlycompanyevents[$i] = $exhibitionevent;
                 $i++;
             } else {
                 $finishedcompanyevents[$i] = $exhibitionevent;
                 $i++;
             }
         }
     }
     return view('home', compact('upcomingexhibitionevents', 'currentlyexhibitionevents', 'tracklogins', 'systemtracks', 'upcomingcompanyevents', 'currentlycompanyevents', 'finishedcompanyevents'));
 }
 public function boothsreport()
 {
     $exhibitionevents = ExhibitionEvent::all();
     $booths = Booth::all();
     $i = 0;
     foreach ($booths as $booth) {
         $data = $booth->name;
         //$allvisitors[$i]=Systemtrack::where('do','LIKE', "%$data%")->count();
         $allvisitors[$i] = Systemtrack::where('type', 'booth')->where('type_id', $booth->id)->count();
         $uniquevisit[$i] = Systemtrack::where('type', 'booth')->where('type_id', $booth->id)->distinct('user_id')->count('user_id');
         $i++;
     }
     return view('AdminCP.reports.booths.boothreport', compact('exhibitionevents', 'booths', 'allvisitors', 'uniquevisit'));
 }
 public function addUserSpotActivityTypeID()
 {
     $spotId = Session::get('spot_id');
     $activityId = Session::get('activity_id');
     $typeId = Session::get('type_id');
     $userID = Auth::User()->id;
     $exhibitionevents = ExhibitionEvent::all();
     $users = User::all();
     $booths = Booth::all();
     $systemtracks = Systemtrack::where('type', 'booth')->get();
     $systemtrack_users = DB::table('systemtracks')->where('systemtracks.type', 'booth')->join('users', 'users.id', '=', 'systemtracks.user_id')->get();
     return view('AdminCP.reports.systemtracks.booth', compact('booths', 'systemtracks', 'users', 'exhibitionevents', 'systemtrack_users'));
     DB::table('systemtracks')->insert(['user_id' => $userID, 'spot_id' => $spotId, 'activity_id' => '*****@*****.**', 'type_id' => 0]);
 }
 public function eventsreport()
 {
     $exhibitionevents = ExhibitionEvent::all();
     $booths = array();
     $i = 0;
     foreach ($exhibitionevents as $exhibitionevent) {
         $booths[$i] = Booth::where('exhibition_event_id', $exhibitionevent->id)->count();
         $data = $exhibitionevent->name;
         // $allvisitors[$i]=Systemtrack::where('do','LIKE', "%$data%")->count();
         $allvisitors[$i] = Systemtrack::where('type', 'exhibitionevent')->where('type_id', $exhibitionevent->id)->count();
         $uniquevisit[$i] = Systemtrack::where('type', 'exhibitionevent')->where('type_id', $exhibitionevent->id)->distinct('user_id')->count('user_id');
         $i++;
     }
     //var_dump($uniquevisit); exit();
     return view('AdminCP.reports.exhibitionevents.eventreport', compact('exhibitionevents', 'booths', 'allvisitors', 'uniquevisit'));
 }
 /**
  * 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'));
 }
 public function booth()
 {
     if (!$this->adminAuth()) {
         return view('errors.404');
     }
     $exhibitionevents = ExhibitionEvent::all();
     $users = User::all();
     $booths = Booth::all();
     $systemtracks = Systemtrack::where('type', 'booth')->get();
     $systemtrack_users = DB::table('systemtracks')->where('systemtracks.type', 'booth')->join('users', 'users.id', '=', 'systemtracks.user_id')->get();
     return view('AdminCP.reports.systemtracks.booth', compact('booths', 'systemtracks', 'users', 'exhibitionevents', 'systemtrack_users'));
 }