3 weeks ago

How to make user personal records simple optional?

Posted 3 weeks ago by webfuelcode

I am using resource in route just to avoid messing up with route name whenever calling. So here I stuck in updating the user details. Trying to make it simple and optional entry.

public function update(Request $request, User $user)
        $this->validate(request(), [
            'name' => 'required',
            'email' => 'required|email|unique:users',
            'password' => 'required|min:6|confirmed'

        $user->name = request('name');
        $user->email = request('email');
        $user->password = bcrypt(request('password'));

        return redirect()->back()->withMessage('Your personal data is successfully edited!');

Suppose I want to let the member just change the password. Do I need to get a separate view page and a separate controller function?

Please sign in or create an account to participate in this conversation.