When trying to import a XLS I get the following error
Unable to resolve NULL driver for [Maatwebsite\Excel\Transactions\TransactionManager].
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].
Even though I'm not using Mongo I tried disabling transactions as suggested at #1998, but it changed nothing.
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.
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.