Example of Excel Import in akaunting/akaunting

File composer.json (link to Github)
{
    //
    "require": {
        "php": "^7.3.0",
        //
        "maatwebsite/excel": "3.1.*",
        //
   }
    //
}
File routes/admin.php (link to Github)
use Illuminate\Support\Facades\Route;

//
Route::group(['prefix' => 'purchases'], function () {
    //
    Route::post('payments/import', 'Purchases\Payments@import')->name('payments.import');
    //
});
//
File app/Http/Controllers/Purchases/Payments.php (link to Github)
use App\Abstracts\Http\Controller;
use App\Http\Requests\Common\Import as ImportRequest;
use App\Imports\Purchases\Payments as Import;

class Payments extends Controller
{
    //
    public function import(ImportRequest $request)
    {
        $response = $this->importExcel(new Import, $request, trans_choice('general.payments', 2));

        if ($response['success']) {
            $response['redirect'] = route('payments.index');

            flash($response['message'])->success();
        } else {
            $response['redirect'] = route('import.create', ['purchases', 'payments']);

            flash($response['message'])->error()->important();
        }

        return response()->json($response);
    }
    //
}
File app/Imports/Purchases/Payments.php (link to Github)
use App\Abstracts\Import;
use App\Http\Requests\Banking\Transaction as Request;
use App\Models\Banking\Transaction as Model;

class Payments extends Import
{
    public function model(array $row)
    {
        return new Model($row);
    }

    public function map($row): array
    {
        $row = parent::map($row);

        $row['type'] = 'expense';
        $row['account_id'] = $this->getAccountId($row);
        $row['category_id'] = $this->getCategoryId($row, 'expense');
        $row['contact_id'] = $this->getContactId($row, 'vendor');
        $row['document_id'] = $this->getDocumentId($row);

        return $row;
    }

    public function rules(): array
    {
        return (new Request())->rules();
    }
}
File app/Http/Requests/Common/Import.php (link to Github)
use Illuminate\Foundation\Http\FormRequest;

class Import extends FormRequest
{
    public function rules()
    {
        return [
            'import' => 'required|file|extension:' . config('excel.imports.extensions'),
        ];
    }
}
File app/Imports/Purchases/Payments.php (link to Github)
use App\Abstracts\Import;
use App\Http\Requests\Banking\Transaction as Request;
use App\Models\Banking\Transaction as Model;

class Payments extends Import
{
    public function model(array $row)
    {
        return new Model($row);
    }

    public function map($row): array
    {
        $row = parent::map($row);

        $row['type'] = 'expense';
        $row['account_id'] = $this->getAccountId($row);
        $row['category_id'] = $this->getCategoryId($row, 'expense');
        $row['contact_id'] = $this->getContactId($row, 'vendor');
        $row['document_id'] = $this->getDocumentId($row);

        return $row;
    }

    public function rules(): array
    {
        return (new Request())->rules();
    }
}
File resources/views/common/import/create.blade.php (link to Github)
@extends('layouts.admin')

@section('title', trans('import.title', ['type' => $title_type]))

@section('content')
    <div class="card">
        {!! Form::open($form_params) !!}

            <div class="card-body">
                <div class="row">
                    <div class="col-md-12">
                        <div class="alert alert-warning alert-important">
                            {!! trans('import.limitations', ['extensions' => strtoupper(config('excel.imports.extensions')), 'row_limit' => config('excel.imports.row_limit')]) !!}
                        </div>
                    </div>
                    <div class="col-md-12">
                        <div class="alert alert-info alert-important">
                            {!! trans('import.sample_file', ['download_link' => $sample_file]) !!}
                        </div>
                    </div>

                    {{ Form::fileGroup('import', '', 'plus', ['dropzone-class' => 'form-file', 'options' => ['acceptedFiles' => '.xls,.xlsx']], null, 'col-md-12') }}
                </div>
            </div>

            <div class="card-footer">
                <div class="row save-buttons">
                    <div class="col-xs-12 col-sm-12">
                        @if (!empty($route))
                            <a href="{{ route(\Str::replaceFirst('.import', '.index', $route)) }}" class="btn btn-outline-secondary">
                                {{ trans('general.cancel') }}
                            </a>
                        @else
                            <a href="{{ url($path) }}" class="btn btn-outline-secondary">
                                {{ trans('general.cancel') }}
                            </a>
                        @endif

                        {!! Form::button(
                            '<span v-if="form.loading" class="btn-inner--icon"><i class="aka-loader"></i></span> <span :class="[{\'ml-0\': form.loading}]" class="btn-inner--text">' . trans('import.import') . '</span>',
                            [':disabled' => 'form.loading', 'type' => 'submit', 'class' => 'btn btn-icon btn-success']) !!}
                    </div>
                </div>
            </div>

        {!! Form::close() !!}
    </div>
@endsection

@push('scripts_start')
    <script src="{{ asset('public/js/common/imports.js?v=' . version('short')) }}"></script>
@endpush