Laravel-excel: db.connection EntryNotFoundException in Lumen 6

Created on 5 Feb 2020  路  2Comments  路  Source: Maatwebsite/Laravel-Excel

Versions

  • PHP version: 7.3.9
  • Laravel version: Lumen v6.0
  • Package version: 3.1

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

bug

Most helpful comment

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',
    ],

All 2 comments

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

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',
    ],
Was this page helpful?
0 / 5 - 0 ratings