filament-auditing
filament-auditing copied to clipboard
Undocumented requirement on Laravel 9.x
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.
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);
});