/** * Store a newly created resource in storage. * * @return Response */ public function store() { // $v = Validator::make(Request::all(), ['city' => 'required|max:30', 'dob' => 'required', 'phone' => 'required']); if ($v->fails()) { return redirect()->back()->withErrors($v->errors())->withInput(); } else { $gInfo = new Generalinfo(); $userId = Auth::user()->id; $gInfo->user_id = $userId; $gInfo->country_id = Request::get('country'); $gInfo->city = Request::get('city'); $gInfo->dob = Request::get('dob'); //$gInfo->image = Request::get('image'); $gInfo->address = Request::get('address'); $gInfo->phone = Request::get('phone'); $gInfo->anotherphone = Request::get('anotherphone'); $gInfo->skypename = Request::get('skypename'); $gInfo->howhearaboutus = Request::get('howhearaboutus'); if (Request::hasFile('image')) { $destination = 'uploads/'; $imagename = str_random(6) . "_" . Request::file('image')->getClientOriginalName(); Request::file('image')->move($destination, $imagename); $file->image = $imagename; } else { $file->image = Request::get('image'); } $gInfo->save(); // if (Request::hasFile('image')) // { // $Image = Request::file('image'); // $imagename = $Image->getClientOriginalExtension(); // $path = public_path('uploads/' . $imagename); // Image::make($image->getRealPath())->resize(200, 200)->save($path); // $gInfo->image = $imagename; // $gInfo->save(); // } $userInterest = new UserInterest(); $userInterest->user_id = $userId; $userInterest->interest_id = Request::get('interest'); $userInterest->save(); $userInterest = new UserInterest(); $userInterest->user_id = $userId; $userInterest = Request::get('interest'); foreach ($userInterest as $userInterest_id) { //echo $userInterest_id; DB::insert('INSERT INTO user_interests (interest_id, user_id) VALUES (?,?)', array($userInterest_id, $userId)); } return redirect('professionalinfos/create'); } }
/** * Store a newly created resource in storage. * * @return Response */ public function store() { // $v = Validator::make(Request::all(), ['city' => 'required|max:30', 'dob' => 'required', 'phone' => 'required']); if ($v->fails()) { return redirect()->back()->withErrors($v->errors())->withInput(); } else { $gInfo = new Generalinfo(); $userId = Auth::user()->id; $gInfo->user_id = $userId; $gInfo->country_id = Request::get('country'); $gInfo->city = Request::get('city'); $gInfo->dob = Request::get('dob'); $gInfo->image = Request::get('image'); $gInfo->address = Request::get('address'); $gInfo->phone = Request::get('phone'); $gInfo->anotherphone = Request::get('anotherphone'); $gInfo->skypename = Request::get('skypename'); $gInfo->howhearaboutus = Request::get('howhearaboutus'); $gInfo->save(); $userInterest = new UserInterest(); $userInterest->user_id = $userId; $userInterest->interest_id = Request::get('interest'); $userInterest->save(); return redirect('professionalinfos/create'); } }