/** * Run the database seeds. * * @return void */ public function run() { DB::table('users')->delete(); Users::create(['number' => '111', 'password' => Hash::make('111')]); Users::create(['number' => '222', 'password' => Hash::make('222')]); Users::create(['number' => '333', 'password' => Hash::make('333')]); }
/** * Sign up new user */ public function postSignupAction() { $post = $this->request->getPost()->all(); $validation = new Validation(); $validation->rules(['name' => 'required', 'email' => 'required|email|unique:users']); $valid = $validation->validate($post); if (!$valid) { echo 'Warning! Please correct the errors:<br />'; foreach ($validation->getMessages() as $message) { echo $message[0] . '<br />'; } } else { $user = new Users(); $user->setFields(['name', 'email']); if ($user->create($post)) { echo "Thanks for registering!"; } } $this->view->setContent(false); }