/** * 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')); }
/** * list booth of certain company in certain events * @param integer $id * @return Response */ public function listboothsofcompanyinthisevent($id) { if (!$this->companyAuth($id)) { return view('errors.404'); } $user = User::find($id); $company = Company::where('user_id', $user->id)->get(); $company = $company[0]; $companyId = $company->id; $exhibitors = Exhibitor::where('company_id', $companyId)->get(); $booths = array(); $i = 0; foreach ($exhibitors as $exhibitor) { $booths = Booth::where('exhibitor_id', $exhibitor->id)->get(); $booths[$i] = $booths[0]; $i++; } // var_dump($booths); exit(); return view('booths.index', compact('booths')); }
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')); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { // $boothId = Request::get('id'); Booth::where('id', $boothId)->delete(); return redirect("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')); }