/**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker::create();
     for ($i = 0; $i < 10; $i++) {
         $user = \App\UserModel::create(['username' => $faker->userName, 'password' => $faker->md5, 'full_name' => $faker->title . ' ' . $faker->name]);
     }
 }
 /**
  * Saving Country of the User
  * @param Request $request
  * @return \Illuminate\Http\JsonResponse
  */
 public function saveCountry(Request $request)
 {
     $validator = Validator::make($request->all(), ['country' => 'required|in:' . implode(",", array_keys(FormDataRepository::countryList()))]);
     if ($validator->fails()) {
         return $validator->errors()->all();
     }
     if (!$request->session()->has(AppSession::USER_ID)) {
         $user = UserModel::create(['country' => $request->country]);
         $user->save();
     } else {
         $user = UserModel::findOrNew($request->session()->get(AppSession::USER_ID));
         $user->country = $request->country;
         $user->save();
     }
     AppSession::updateUserDataSession($request->session(), $user);
     return response()->json([APIResponse::REQUEST_STATUS => APIResponse::SUCCESSFUL]);
 }
Example #3
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $secret = $this->authenticator->generateSecretKey();
     $website = 'http://localhost:8888/laravel-app';
     $user = array('firstname' => $request->firstname, 'lastname' => $request->lastname, 'email' => $request->email, 'password' => bcrypt($request->password), 'secret' => $secret);
     $qrcode = $this->authenticator->getQRCodeGoogleUrl($request->email, $website, $secret);
     UserModel::create($user);
     return view('users.qrcode', compact('qrcode'));
 }