I'm encountering the following error when using the maatwebsite/laravel-nova-excel package in a Laravel Nova project:
Cannot access offset of type Laravel\Nova\Support\PendingTranslation on array
I install it with this command
composer require psr/simple-cache:^2.0 maatwebsite/laravel-nova-excel
and I use it like this:
use Maatwebsite\LaravelNovaExcel\Actions\DownloadExcel;
public function actions(NovaRequest $request): array
{
return [
new DownloadExcel(),
];
}
I tried:
I am using laravel 11 and laravel nova 5
I am experiencing the same problem. When ID column name is not specified, Nova passes PendingTranslation class instance instead of column name into $only argument of ExportToExcel::replaceFieldValuesWhenOnResource https://github.com/SpartnerNL/Laravel-Nova-Excel/blob/1.3/src/Actions/ExportToExcel.php#L220.
Temporary fix is to pass name of id column when defining id field - ID::make('ID')
.