public function store(CreateUserRequest $request) { $user = new User($request->only(['name', 'email', 'role', 'password'])); $user->save(); session()->flash('success', 'El usuario se ha creado.'); return redirect()->route('admin.user.edit', $user->id); }
/** * Store a newly created resource in storage. * * @param CreateUserRequest $request * * @return \Illuminate\Http\Response */ public function store(CreateUserRequest $request) { $values = $request->only(['first_name', 'last_name', 'email', 'password']); User::create($values); return response()->json(['message' => 'User successfully created.', 'code' => 201], 201); }