public function getPage3() { $userdetails = array('name' => Session::get('username'), 'event' => Session::get('event')); // $questions = Question::where('event','=',Session::get('event'))->where('page','=',3)->orderBy('order')->with('choices') // ->with(array('answers'=>function($query){ // $query->where('user_id','=',Session::get('userid')); // }))->get(); $questions = Question::where('page', '=', 3)->orderBy('order')->with('choices')->with(array('answers' => function ($query) { $query->where('user_id', '=', Session::get('userid')); }))->get(); $categoryvendors = Categoryvendor::where('event', '=', Session::get('event'))->with(array('categoryvendoranswer' => function ($q) { $q->where('user_id', '=', Session::get('userid')); }))->get(); return View::make('forms.page3')->with(array('userdetails' => $userdetails, 'questions' => $questions, 'categoryvendors' => $categoryvendors)); // return View::make('forms.page3')->with(array('userdetails'=>$userdetails,'questions'=>$questions)); }
public function postCategoryvendorsbulk() { /* $rules = array( 'vendorname'=>'required', 'event'=>'required', 'categoryname'=>'required', ); */ $rules = array('vendorname' => 'required', 'categoryname' => 'required', 'logo' => 'required'); $validator = Validator::make(Input::all(), $rules); /* if($validator->passes()){ foreach(Input::get('event') as $event){ foreach(Input::get('categoryname') as $category){ $cv = new Categoryvendor(); $cv->categoryname = $category; $cv->vendorname = Input::get('vendorname'); $cv->event = $event; $cv->save(); } } return Redirect::to('admin/categoryvendorsbulk')->with('message', 'Category Vendor Added'); } */ if ($validator->passes()) { //foreach(Input::get('vendorname') as $vendor){ foreach (Input::get('categoryname') as $category) { $cv = new Categoryvendor(); $cv->categoryname = $category; $cv->vendorname = Input::get('vendorname'); $cv->url = Input::get('url'); $image1 = Input::file('logo'); $filename = date('Y-m-d-hh-mm-ss') . '-' . $image1->getClientOriginalName(); $path = public_path('/images/admin/categoryvendors/' . $filename); Image::make($image1->getRealPath())->resize(100, 100)->save($path); $cv->imgpath = 'images/admin/categoryvendors/' . $filename; $cv->save(); } //} return Redirect::to('admin/categoryvendorsbulk')->with('message', 'Category Vendor Added'); } return Redirect::to('admin/categoryvendorsbulk')->with('message', 'Could not Add - Please mention vendor name/logo/web url & select events / categories.'); }
$tempansarr[$ansobj->question_id] = $ansobj->answer_text; } foreach ($usa->categoryvendoranswer as $catansobj) { $tempcatansarr[$catansobj->categoryvendor_id] = $catansobj->answer; } $useransarr[$usa->id]['login'] = $usa->email; $useransarr[$usa->id]['id'] = $usa->id; $useransarr[$usa->id]['answers'] = $tempansarr; $useransarr[$usa->id]['catanswers'] = $tempcatansarr; // dd($useransarr[]); } //dd($userswithanswers); // $questions = Question::all(); // $users = User::whereIn('id', $user_ids)->get(); $questions = Question::orderBy('page')->where('event', '=', $exceleve)->where('page', '!=', 0)->orderBy('order')->get(); $categoryvendors = Categoryvendor::all(); // HEADER ROW FOR FOR EXCEL $header1 = array(); $header1[] = ''; $header2 = array(); $header2[] = 'Login'; $preprojectnumber = ''; foreach ($questions as $header) { /*echo $header->class_name."<br>"; echo $header->question_group."<br>";*/ if ($header->class_name != 'projects checkbox group') { //echo "1"; $header1[] = $header->question_group; $header2[] = $header->question_text; } else { if ($header->question_group != $preprojectnumber) {