/** * store exhibitor by admin * * @return Response */ 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')); } }