This commit is contained in:
2023-07-28 12:18:13 +02:00
parent f5977c1b5d
commit d943e81da4
14 changed files with 209 additions and 69 deletions

View File

@@ -29,12 +29,19 @@ class CategoryController
public function store(CategoryRequest $request)
{
$validate = $request->validated();
if ($category = $this->categoryRepository->create($validate)) {
return redirect()->route('admin.category.update', ['category' => $category])->with('message', 'Utworzono kategorię!');
}
// $validate = $request->validated();
// if ($category = $this->categoryRepository->create($validate)) {
// return redirect()
// ->route('admin.category.update', compact('category'))
// ->with('message', 'Utworzono kategorię!');
// }
return back()->withError(['message_error', 'Wystąpił błąd podczas tworzenia!']);
// return back()->withError(['message_error', 'Wystąpił błąd podczas tworzenia!']);
$category = $this->categoryRepository->create($request->validated());
return redirect()
->route('admin.category.update', compact('category'))
->with('message', 'Utworzono kategorię!');
}
public function create(): View