/** * Run the database seeds. * * @return void */ public function run() { $user = \teambernieny\User::firstOrCreate(['email' => '*****@*****.**']); $user->name = 'Admin'; $user->email = '*****@*****.**'; $user->password = \Hash::make('B3rn90()'); $user->role = 'admin'; $user->save(); $user = \teambernieny\User::firstOrCreate(['email' => '*****@*****.**']); $user->name = 'Annalisa'; $user->email = '*****@*****.**'; $user->password = \Hash::make('B3rn90()'); $user->role = 'admin'; $user->save(); }
public function postAdd(Request $request) { $users = \teambernieny\User::where('email', '=', $request->email)->get(); if (sizeof($users) > 0) { return view('user.add')->with('message', "User already exists"); } else { $user = new \teambernieny\User(); $user->name = $request->name; $user->email = $request->email; $user->password = \Hash::make($request->password); $user->role = $request->role; $user->save(); return view('user.add')->with('message', "User Added"); } }
/** * 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'])]); }