예제 #1
0
 /**
  * Store a newly created resource in storage.
  *
  * @param UserCreateRequest $request
  *
  * @return Response
  */
 public function store(UserCreateRequest $request)
 {
     $user = User::create($request->all());
     // Insert related models
     $profile = new UserProfile();
     $user->profile()->save($profile);
     return redirect()->route('admin.users.index')->with('success', trans('admin/user/messages.create.success'));
 }
예제 #2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('users')->delete();
     $users = [['username' => 'admin', 'name' => 'Administrator', 'email' => '*****@*****.**', 'password' => 'admin', 'role' => 'administrator'], ['username' => 'user', 'name' => 'User', 'email' => '*****@*****.**', 'password' => 'user', 'role' => 'default']];
     foreach ($users as $data) {
         $user = \Gamify\User::create(['username' => $data['username'], 'name' => $data['name'], 'email' => $data['email'], 'password' => $data['password'], 'role' => $data['role']]);
         $profile = new \Gamify\UserProfile(['gender' => 'female']);
         $user->profile()->save($profile);
         Log::info('Created user ' . $data['username']);
     }
 }