public function update($user)
    {
        $user = User::find($user);
        if (!$user) {
            return redirect_to_resource();
        }

        $attributes = request()->validate([
            'firstname' => 'required',
            'lastname'  => 'required',
            'cellphone' => 'required',
            'telephone' => 'nullable',
            'born_at'   => 'nullable',
            'etokens'   => 'nullable',
            'email'     => 'required|email|' . Rule::unique('users')->ignore($user->id),
            'roles'     => 'required|array',
        ]);

        unset($attributes['roles']);

        $this->updateEntry($user, $attributes);

        $user->roles()->sync(input('roles'));

        return redirect_to_resource();
    }
public function update($user)
    {
        $user = User::find($user);
        if (!$user) {
            return redirect_to_resource();
        }

        $attributes = request()->validate([
            'firstname' => 'required',
            'lastname'  => 'required',
            'cellphone' => 'required',
            'telephone' => 'nullable',
            'born_at'   => 'nullable',
            'etokens'   => 'nullable',
            'email'     => 'required|email|' . Rule::unique('users')->ignore($user->id),
            'roles'     => 'required|array',
        ]);

        unset($attributes['roles']);

        $this->updateEntry($user, $attributes);

        $user->roles()->sync(input('roles'));

        return redirect_to_resource();
    }
public function update ( $ user ) { $ user = User :: find ( $ user ) ; if ( ! $ user ) { return redirect_to_resource ( ) ; } $ attributes = request ( ) -> validate ( [ 'firstname' => 'required' , 'lastname' => 'required' , 'cellphone' => 'required' , 'telephone' => 'nullable' , 'born_at' => 'nullable' , 'etokens' => 'nullable' , 'email' => 'required|email|' . Rule :: unique ( 'users' ) -> ignore ( $ user -> id ) , 'roles' => 'required|array' , ] ) ; unset ( $ attributes [ 'roles' ] ) ; $ this -> updateEntry ( $ user , $ attributes ) ; $ user -> roles ( ) -> sync ( input ( 'roles' ) ) ; return redirect_to_resource ( ) ; }
Update the specified client in storage.

@param User $user
@return Response
Update the specified client in storage .