Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undocumented requirement on Laravel 9.x #21

Open
peters-cmc opened this issue Jan 19, 2024 · 1 comment
Open

Undocumented requirement on Laravel 9.x #21

peters-cmc opened this issue Jan 19, 2024 · 1 comment

Comments

@peters-cmc
Copy link

Running legacy Laravel v8 application, Filament v2, Laravel Auditing v13; This plugin can be installed and configured correctly, and displays the Audit tab for the resource, however selecting the tab throws an exception.

Method Illuminate\Support\Arr::map does not exist.

From the Laravel documentation Arr::map was not introduced until Laravel 9 (https://laravel.com/docs/9.x/helpers#method-array-map).

AuditsRelationManager.php references this method:

protected static function extraColumns()
    {
        return Arr::map(config('filament-auditing.audits_extend'), function ($buildParameters, $columnName) {
            return collect($buildParameters)->pipeThrough([
            // etc

Auditing v13 looks to support Laravel v7 onwards.

@peters-cmc
Copy link
Author

FWIW I've solved this temporarily by using macros to backport the Arr::map behaviour into this application while I assess our auditing behaviour.

// @see https://github.com/laravel/framework/blob/dc2e925b2d75fc2673a5919c7ad727d68059c08e/src/Illuminate/Collections/Arr.php#L555
Arr::macro('map', function (array $array, callable $callback) {
    $keys = array_keys($array);

    try {
        $items = array_map($callback, $array, $keys);
    } catch (ArgumentCountError) {
        $items = array_map($callback, $array);
    }

    return array_combine($keys, $items);
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant