Пример #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'));
 }
Пример #2
0
 /**
  * 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'));
 }
Пример #3
0
 public function bookBooth($id)
 {
     if (!$this->adminAuth() && !$this->checkCompanyType()) {
         return view('errors.404');
     }
     $exhibitioneventId = $id;
     $checExEv = ExhibitionEvent::find($exhibitioneventId);
     if (date("Y-m-d H:i:s") > $checExEv->start_time) {
         return view('errors.404');
     }
     $exhibitors = Exhibitor::all();
     $exhibitionevents = ExhibitionEvent::all();
     $types = Type::all();
     $models = Modeldesign::all();
     $spots = Spot::all();
     return view('CompanyCP.booths.create', compact('types', 'models', 'exhibitors', 'exhibitionevents', 'exhibitioneventId', 'spots'));
 }
Пример #4
0
 /**
  * destroy company exhibitor when log in as company
  * @param  integer $id
  * @return Response
  */
 public function destroyCompanyExhibitor($id)
 {
     //
     $exhibitorId = Request::get('id');
     Exhibitor::where('id', $exhibitorId)->delete();
     return redirect("/companies/showexhibitorsofcompanybyuserid/" . Auth::User()->id);
 }
Пример #5
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     //
     $seriesevent = SeriesEvent::find($id);
     $exhibitions = Exhibition::all();
     $exhibitors = Exhibitor::all();
     return view('seriesevents.edit', compact('seriesevent', 'exhibitors', 'exhibitions'));
 }
 public function storeexhibitorbyadmin()
 {
     $v = Validator::make(Request::all(), ['name' => 'required|max:50', 'company' => 'required']);
     if ($v->fails()) {
         return redirect()->back()->withErrors($v->errors())->withInput();
     } else {
         $exhibitor = new Exhibitor();
         $exhibitor->company_id = Request::get('company');
         $exhibitor->country_id = Request::get('country');
         $exhibitor->city = Request::get('city');
         $exhibitor->address = Request::get('address');
         $exhibitor->name = Request::get('name');
         $exhibitor->desc = Request::get('desc');
         $exhibitor->phone = Request::get('phone');
         $exhibitor->anotherphone = Request::get('anotherphone');
         $exhibitor->fax = Request::get('fax');
         $exhibitor->save();
         // File Storage
         $file = new File();
         $file->name = Request::get('filename');
         $file->desc = Request::get('filedesc');
         $file->type = Request::get('filetype');
         if (Request::hasFile('file')) {
             $destination = 'files/';
             $filename = str_random(6) . "_" . Request::file('file')->getClientOriginalName();
             Request::file('file')->move($destination, $filename);
             $file->file = $filename;
         } else {
             $file->file = Request::get('file');
         }
         $file->save();
         $exhibitorfile = new ExhibitorFile();
         $exhibitorfile->exhibitor_id = $exhibitor->id;
         $exhibitorfile->file_id = $file->id;
         $exhibitorfile->save();
         // Admin
         if ($this->adminAuth()) {
             return redirect('exhibitors');
         }
         //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();
         return view('companies.listallexhibitorsofCompany', compact('exhibitors'));
     }
 }