app/Http/Controllers/App/UserController.php
/**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
Update the specified resource in storage.
Update the specified resource in storage .
public function update(Request $request, User $user)
    {
        $rules = [
            'name' => ['required', 'string', 'max:255'],
            'email' => ['required', 'string', 'email', 'max:255', 'unique:users,email,'. $user->id],
        ];
        $request->validate($rules);
        $data = [
            'name' => $request->get('name'),
            'email' => $request->get('email'),
        ];
        $user->update($data);
        return redirect()->route('app.user.index');
    }
public function update ( Request $ request , User $ user ) { $ rules = [ 'name' => [ 'required' , 'string' , 'max:255' ] , 'email' => [ 'required' , 'string' , 'email' , 'max:255' , 'unique:users,email,' . $ user -> id ] , ] ; $ request -> validate ( $ rules ) ; $ data = [ 'name' => $ request -> get ( 'name' ) , 'email' => $ request -> get ( 'email' ) , ] ; $ user -> update ( $ data ) ; return redirect ( ) -> route ( 'app.user.index' ) ; }
Update the specified resource in storage.
Update the specified resource in storage .