Ejemplo n.º 1
0
 /**
  * Create a new user using register page and store data in this function.
  *
  */
 public function createuser()
 {
     $confirmation_code = str_random(30);
     $v = Validator::make(Request::all(), ['name' => 'required|max:255', 'email' => 'required|email|max:255|unique:users', 'password' => 'required|confirmed|min:6']);
     if ($v->fails()) {
         return redirect()->back()->withErrors($v->errors())->withInput();
     } else {
         $user = new User();
         $user->name = Request::get('name');
         $user->email = Request::get('email');
         $user->type = Request::get('type');
         $user->password = bcrypt(Request::get('password'));
         $user->confirmation_code = $confirmation_code;
         $user->save();
         $gInfo = new Generalinfo();
         $gInfo->user_id = $user->id;
         $gInfo->country_id = Request::get('country');
         $gInfo->city = Request::get('city');
         $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->dob = Request::get('dob');
         // if (Request::hasFile('image')) {
         // 	$destination= 'uploads/';
         // 	$imagename=str_random(6)."_".Request::file('image')->getClientOriginalName();
         // 	Request::file('image')->move($destination,$imagename);
         // 	$gInfo->image=$imagename;
         // }
         $gInfo->save();
         $userInterest = new UserInterest();
         $userInterest->user_id = $user->id;
         $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, $user->id));
         }
         $pInfo = new Professionalinfo();
         $pInfo->user_id = $user->id;
         $pInfo->currentjob = Request::get('currentjob');
         $pInfo->title = Request::get('title');
         $pInfo->startwork_at = Request::get('startwork_at');
         $pInfo->companywebsite = Request::get('companywebsite');
         $pInfo->d_maker = Request::get('d_maker');
         $pInfo->colleage = Request::get('colleage');
         $pInfo->degree = Request::get('degree');
         $pInfo->graduated_at = Request::get('graduated_at');
         $pInfo->fax = Request::get('fax');
         $pInfo->facebook = Request::get('facebook');
         $pInfo->twitter = Request::get('twitter');
         $pInfo->linkedIn = Request::get('linkedIn');
         $pInfo->ownwebsite = Request::get('ownwebsite');
         $pInfo->language = Request::get('language');
         $pInfo->save();
         if ($user->type == "company") {
             $companyInfo = new Company();
             $companyInfo->user_id = $user->id;
             $companyInfo->save();
             // return redirect('companies');
         }
         $data['email'] = Request::get('email');
         $data['name'] = Request::get('name');
         $data['confirmation_code'] = $confirmation_code;
         Mail::send('emails.welcome', $data, function ($message) use($data) {
             $message->from('*****@*****.**', "Wavexpo");
             $message->subject("Welcome to Wavexpo Please visit our website to continu you information");
             $message->to($data['email']);
         });
         return redirect('/register/redirect');
     }
 }
Ejemplo n.º 2
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     //
     $v = Validator::make(Request::all(), ['name' => 'required|max:255', 'email' => 'required|email|max:255|unique:users', 'password' => 'required|confirmed|min:6']);
     if ($v->fails()) {
         return redirect()->back()->withErrors($v->errors())->withInput();
     } else {
         $user = new User();
         $user->name = Request::get('name');
         $user->email = Request::get('email');
         $user->type = Request::get('type');
         $user->password = bcrypt(Request::get('password'));
         $user->save();
         $gInfo = new Generalinfo();
         $gInfo->user_id = $user->id;
         $gInfo->save();
         $pInfo = new Professionalinfo();
         $pInfo->user_id = $user->id;
         $pInfo->save();
         $data['email'] = Request::get('email');
         $data['name'] = Request::get('name');
         // Mail::send('emails.welcome', $data, function($message) use ($data)
         //           {
         //               $message->from('*****@*****.**', "Wavexpo");
         //               $message->subject("Welcome to Wavexpo Please visit our website to continu you information");
         //               $message->to($data['email']);
         //           });
         //return redirect()->action('UserFilesController@store', [$user->id,]);
         // File Storage
         $file = new File();
         $file->name = Request::get('filename');
         $file->desc = Request::get('desc');
         $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();
         $userfile = new UserFile();
         $userfile->user_id = $user->id;
         $userfile->file_id = $file->id;
         $userfile->save();
         return redirect('users');
     }
 }
Ejemplo n.º 3
0
 /**
  * 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');
     }
 }