Exemplo n.º 1
0
 public function postClientSignUp(Request $request)
 {
     $rules = ['email' => 'required|email', 'password' => 'required|min:6|max:20', 'password2' => 'required|same:password'];
     $this->validate($request, $rules);
     $name = $request->get('name', '');
     $email = $request->get('email');
     $password = $request->get('password');
     $localUser = UserMapper::getByEmail($email);
     if ($localUser && $localUser->type == 'client') {
         return Redirect::back()->withErrors(['email' => 'Client with this email already exists'])->withInput($request->all());
     }
     if ($name == '') {
         $name = anonymizeEmail($email);
     }
     $data = ['name' => $name, 'email' => $email, 'password' => $password];
     $localUser = $this->create($data);
     $localUser->is_active = 0;
     $localUser->role = 'user';
     $localUser->type = 'client';
     $localUser->save();
     LogMapper::log('client_register', $localUser->id);
     NotificationMapper::registration($localUser);
     $this->sendClientWelcome($localUser, $password);
     $user = $localUser;
     return view('app.pages.user.client.auth.post_register', compact('user'));
 }
Exemplo n.º 2
0
 public function clients($limit = 1000)
 {
     $faker = $this->faker;
     for ($i = 0; $i < $limit; $i++) {
         $user = User::create(['name' => $faker->firstName, 'email' => $faker->freeEmail, 'password' => bcrypt('1'), 'last_activity' => \Carbon\Carbon::createFromTimestamp($faker->unixTime), 'role' => 'user', 'type' => 'client', 'provider' => 'local', 'balance' => rand(0, 100)]);
         $profile = UserProfile::create(['first_name' => $user->name, 'last_name' => $faker->lastName, 'user_id' => $user->id]);
         LogMapper::log('client_register', $user->id);
         NotificationMapper::registration($user);
     }
 }