app/Http/Controllers/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)
    {
        $request->validate([
            'name'          => 'required|max:50|unique:users,name,'.$user->id,
            'email'          => 'required|max:50|unique:users,email,'.$user->id
        ]);
        dd($request->all());
        $user->update($request->all());
        $user->roles()->sync($request->get('roles'));
        return redirect()->route('user.index')
            ->with('status_success','User updated successfully');
    }
public function update ( Request $ request , User $ user ) { $ request -> validate ( [ 'name' => 'required|max:50|unique:users,name,' . $ user -> id , 'email' => 'required|max:50|unique:users,email,' . $ user -> id ] ) ; $ user -> update ( $ request -> all ( ) ) ; $ user -> roles ( ) -> sync ( $ request -> get ( 'roles' ) ) ; return redirect ( ) -> route ( 'user.index' ) -> with ( 'status_success' , 'User updated successfully' ) ; }
Update the specified resource in storage.
Update the specified resource in storage .
// //dd($request->all());