'catalog', 'title' => 'Каталог', ]; public function index(Request $request) { $this->data['products'] = Product::query()->paginate()->withQueryString(); return view('catalog.index', $this->data); } public function show() { } /** * @param Request $request * @return RedirectResponse */ public function import(Request $request) { // validate data $request->validate([ 'year' => 'required|integer|min:2000|max:' . (int)date('Y', strtotime('next year')), 'import_file' => 'file', ]); // load and save file $path = Str::random(2) . '/' . Str::uuid() . '.' .$request->file('import_file')->getClientOriginalExtension(); Storage::disk('upload')->put($path, $request->file('import_file')->getContent()); // dispatch job ImportCatalog::dispatch($path, $request->year, $request->user()->id); Log::info('ImportCatalog job created!'); return redirect()->route('catalog.index')->with(['success' => 'Задача импорта успешно создана!']); } public function export(Request $request) { return redirect()->route('catalog.index')->with(['success' => 'Задача импорта успешно создана!']); } }