name)), '-'); return response($this->exporterService->handle($egg->id), 200, [ 'Content-Transfer-Encoding' => 'binary', 'Content-Description' => 'File Transfer', 'Content-Disposition' => 'attachment; filename=egg-' . $filename . '.json', 'Content-Type' => 'application/json', ]); } /** * Import a new egg using an XML file. * * @throws \App\Exceptions\Model\DataValidationException * @throws \App\Exceptions\Service\Egg\BadJsonFormatException * @throws \App\Exceptions\Service\InvalidFileUploadException */ public function import(EggImportFormRequest $request): RedirectResponse { $egg = $this->importerService->fromFile($request->file('import_file')); $this->alert->success(trans('admin/eggs.notices.imported'))->flash(); return redirect()->route('admin.eggs.view', ['egg' => $egg->id]); } /** * Update an existing Egg using a new imported file. * * @throws \App\Exceptions\Model\DataValidationException * @throws \App\Exceptions\Service\Egg\BadJsonFormatException * @throws \App\Exceptions\Service\InvalidFileUploadException */ public function update(EggImportFormRequest $request, Egg $egg): RedirectResponse { $this->importerService->fromFile($request->file('import_file'), $egg); $this->alert->success(trans('admin/eggs.notices.updated_via_import'))->flash(); return redirect()->route('admin.eggs.view', ['egg' => $egg]); } }