public function run() { $faker = Faker::create(); foreach (range(1, 10) as $index) { \App\Domain\Entities\User::create(['firstname' => $faker->firstName, 'lastname' => $faker->lastName, 'email' => $faker->email, 'password' => $faker->password()])->save(); } }
/** * Store a newly created resource in storage. * * @return \Illuminate\Http\Response */ public function store() { $input = \Input::only('firstname', 'lastname', 'email', 'password'); $user = User::create($input); // attempt validation if ($user->valid()) { $user->save(); } else { // failure, get errors $errors = $user->errors(); return $this->toJSONResponse(['errors' => $errors->getMessages(), 'status' => 400], 400); } return $this->toJSONResponse(['user_id' => $user->id], 201); }
public function run() { $faker = Faker::create(); \App\Domain\Entities\User::create(['firstname' => $faker->firstName, 'lastname' => $faker->lastName, 'email' => '*****@*****.**', 'password' => 'testPassword'])->save(); }
public function run() { \App\Domain\Entities\User::create(['firstname' => 'Administrator', 'lastname' => '', 'email' => 'admin', 'password' => 'admin'])->save(); }
/** * Create a new user instance after a valid registration. * * @param array $data * @return User */ protected function create(array $data) { return User::create(['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password'])]); }