/** * Create a new user instance after a valid registration. * * @param array $data * @return User */ protected function create(array $data) { $user = User::create(['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password'])]); $user_id = $user->id; RoleUser::create(['role_id' => 2, 'user_id' => $user_id]); return $user; }
public function run() { DB::table('role_user')->delete(); $roleuser = array(array('role_id' => 1, 'user_id' => 1)); foreach ($roleuser as $key) { RoleUser::create($key); } }