SpartnerNL / Laravel-Excel

🚀 Supercharged Excel exports and imports in Laravel
https://laravel-excel.com
MIT License
12.27k stars 1.92k forks source link

db.connection EntryNotFoundException in Lumen 6 #2541

Closed rexsee closed 4 years ago

rexsee commented 4 years ago

Versions

Description

Hi, I've follow all the installation steps at https://docs.laravel-excel.com/3.1/getting-started/installation.html and i get this error when i try to export a xlsx file.

I believe the problem occur when i register the service provider in the bootstrap file. $app->register(Maatwebsite\Excel\ExcelServiceProvider::class);

Steps to Reproduce

1) Follow installation steps at https://docs.laravel-excel.com/3.1/getting-started/installation.htm 2) Create a simple export function by follow https://docs.laravel-excel.com/3.1/exports/ 3) Change the data source to array by follow https://docs.laravel-excel.com/3.1/exports/collection.html#using-arrays 4) Check the result

Expected behavior:

Should able to export file successfully

Actual behavior:

error_1 error_2 error_3
patrickbrouwers commented 4 years ago

Looking at the exception is seems there's something not configured correctly in your Lumen application. It's missing a database connection container binding.

rexsee commented 4 years ago

I found the solution. To install successfully at Lumen I need to register the config file in bootstrap/app.php

$app->configure('excel');

and set the db.connection to null in config/excel.php

'transactions' => [
        'handler' => 'null',
    ],