public function run() { //removes existing throttle records from table DB::table('throttle')->delete(); $now = date('Y-m-d H:i:s'); $faker = Faker::create(); foreach (range(1, 21) as $index) { Throttle::create(['user_id' => $faker->unique()->numberBetween(1, 21), 'last_activity' => $now, 'last_login' => $now]); } }
public function processSignUp() { $data = Input::all(); $validator = User::validate_registration($data); if ($validator->fails()) { return Redirect::back()->withErrors($validator)->withInput(Input::except('password', 'password_confirm')); } $code = str_random(32); $user = User::create(['username' => $data['username'], 'email' => $data['email'], 'password' => Hash::make($data['password']), 'activation_code' => $code, 'activated' => 0]); $user->assignMemberRole(); Throttle::create(['user_id' => $user->id]); Profile::create(['user_id' => $user->id]); $activation_link = URL::route('activate', $code); //$user->email is out of scope for the mail closure, hence to access it, we have defined "use ($user)" Mail::send('emails.users.activate', ['link' => $activation_link, 'username' => Input::get('username')], function ($message) use($user) { $message->to($user->email, $user->username)->subject('Activate Your Account'); }); return Redirect::to('login')->withActivationMessage(Lang::get('larabase.signup_success')); }