getImporter($importerType); $importer->init($organization); Storage::disk(config('filesystems.default')) ->put('import/'.Carbon::now()->toDateString().'-'.$organization->getKey().'-'.Str::uuid(), $data); $lock = Cache::lock('import:'.$organization->getKey(), config('octane.max_execution_time', 60) + 1); if ($lock->get()) { DB::transaction(function () use (&$importer, &$data, &$timezone) { $importer->importData($data, $timezone); }); $lock->release(); } else { throw new ImportException('Import is already in progress'); } return $importer->getReport(); } }