From 54e70d639724e57ac53836f815ddd91af680d60e Mon Sep 17 00:00:00 2001 From: Andrea Bergamasco Date: Tue, 5 Aug 2014 14:51:20 +0200 Subject: [PATCH] Added seeding example to documentation, fixes #365 Added a quick example that extends the solution suggested by Zizaco in issue tracker #365 --- README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/README.md b/README.md index cad3274..7c3ab12 100644 --- a/README.md +++ b/README.md @@ -160,6 +160,29 @@ First, publish the config files: Then edit the view names in `app/config/packages/zizaco/confide/config.php`. +#### Seeding + +To seed your users table you should fill also the `password_confirmation` and `confirmation_code` fields: + + class UsersTableSeeder extends Seeder { + + public function run() + { + $user = new User; + $user->username = 'johndoe; + $user->email = 'johndoe@site.dev'; + $user->password = 'foo_bar_1234'; + $user->password_confirmation = 'foo_bar_1234'; + $user->confirmation_code = md5($user->username.time('U')); + + if(! $user->save()) { + Log::info('Unable to create user '.$user->username, (array)$user->errors()); + } else { + Log::info('Created user "'.$user->username.'" <'.$user->email.'>'); + } + } + } + #### Update an User To update an user already in the database you'll want to either pass in an different rule set or use the amend function.