Laravel-excel: [BUG] Unable to resolve NULL driver for [Maatwebsite\Excel\Transactions\TransactionManager]

Created on 2 Oct 2019  ·  5Comments  ·  Source: Maatwebsite/Laravel-Excel

Prerequisites

  • [X ] Checked if your Laravel Excel version is still supported: https://docs.laravel-excel.com/3.1/getting-started/support.html#supported-versions
  • [X ] Able to reproduce the behaviour outside of your code, the problem is isolated to Laravel Excel.
  • [X ] Checked that your issue isn't already filed.
  • [X ] Checked if no PR was submitted that fixes this problem.
  • [X ] Filled in the entire issue template

Versions

  • PHP version: PHP 7.3.9-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Sep 2 2019 12:54:04) ( NTS )
  • Laravel version: v6.0.4
  • Package version: 3.1.17

Description

When trying to import a XLS I get the following error

Unable to resolve NULL driver for [Maatwebsite\Excel\Transactions\TransactionManager].

Steps to Reproduce

The code to import is:

Excel::import(new ProdutosImport, $file)

And the actual import is

<?php

namespace App\Imports;

use App\Produto;
use Maatwebsite\Excel\Concerns\OnEachRow;
use Maatwebsite\Excel\Concerns\WithHeadingRow;

class ProdutosImport implements OnEachRow, WithHeadingRow
{
    /**
     * @param array $row
     *
     * @return \Illuminate\Database\Eloquent\Model|null
     */
    public function onRow($row)
    {
        $row = $row->toArray();
        if ($row['nmero_do_pedido'] !== null && $row['sku'] !== null) {
            $produto = Produto::firstOrNew(['id_venda' => $row['nmero_do_pedido'], 'sku' => $row['sku'], 'sequeencia' => null]);
            $produto->id_venda = $row['nmero_do_pedido'];
            $produto->sequeencia = null;
            $produto->sku = $row['sku'];
            $produto->data_pagamento = $row['data_de_pagamento'];
            $produto->estado_pagamento = $row['status_do_pagamento'];
            $produto->titulo_produto = $row['nome_do_produto'];
            $produto->sub_total = $row['valor_do_produto'];
            $produto->descuento_compra = 0;
            $produto->total_venda = $row['valor_do_produto'];

            $produto->save();
        }
    }
}

Expected behavior:

Import the file.

Actual behavior:

Errors out with
Unable to resolve NULL driver for [Maatwebsite\Excel\Transactions\TransactionManager].

Additional Information

Even though I'm not using Mongo I tried disabling transactions as suggested at #1998, but it changed nothing.

bug

Most helpful comment

Ok, I did some investigation and it's not a bug.

Laravel cache was on the way of the package reading the new published vendor config.

A simple php artisan config:clear did it.

All 5 comments

Have you tried my answer in https://github.com/Maatwebsite/Laravel-Excel/issues/1998#issuecomment-508995478 ? Sounds like your are using the wrong config value.

Have you tried my answer in #1998 (comment) ? Sounds like your are using the wrong config value.

I tried both. Also tried the default configs.

Shouldn't the default configs work, since I'm using MySQL, anyways?

BTW, @patrickbrouwers , I get the same exact message 'Unable to resolve NULL driver' whether I have 'db' or 'null' as a value for 'handler'

Ok, I did some investigation and it's not a bug.

Laravel cache was on the way of the package reading the new published vendor config.

A simple php artisan config:clear did it.

I faced this issue, my problem was that I'm using the library without adding the config file excel.php.

so I traced it by clearing the cache (and it worked), then i added the config file then cached my config again.

I hope this helps.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

amine8ghandi8amine picture amine8ghandi8amine  ·  3Comments

octoxan picture octoxan  ·  3Comments

ellej16 picture ellej16  ·  3Comments

matthewslouismarie picture matthewslouismarie  ·  3Comments

disto picture disto  ·  3Comments