src/Collection/Mutable.php
public function update(string $id, Closure $callback): self
    {
        if (str_contains($id, ',')) {
            collect(explode(',', $id))
                ->map('trim')
                ->each(function ($element) use ($callback) {
                    $this->update($element, $callback);
                });

            return $this;
        }

        $element = $this->find($id);

        if ($element && $callback) {
            $callback($element);
        }

        return $this;
    }
public function update(string $id, Closure $callback): self
    {
        if (str_contains($id, ',')) {
            collect(explode(',', $id))
                ->map('trim')
                ->each(function ($element) use ($callback) {
                    $this->update($element, $callback);
                });

            return $this;
        }

        $element = $this->find($id);

        if ($element && $callback) {
            $callback($element);
        }

        return $this;
    }
public function update ( string $ id , Closure $ callback ) : self { if ( str_contains ( $ id , ',' ) ) { collect ( explode ( ',' , $ id ) ) -> map ( 'trim' ) -> each ( function ( $ element ) use ( $ callback ) { $ this -> update ( $ element , $ callback ) ; } ) ; return $ this ; } $ element = $ this -> find ( $ id ) ; if ( $ element && $ callback ) { $ callback ( $ element ) ; } return $ this ; }
Update elements behaviour.

@param string $id
@param Closure $callback

@return $this
Update elements behaviour .