- wip
This commit is contained in:
@@ -16,6 +16,7 @@ class AdminPanelController extends Controller
|
||||
private ProjectRepository $projectRepository
|
||||
) {
|
||||
$this->categoryRepository->auth = true;
|
||||
$this->projectRepository->auth = true;
|
||||
}
|
||||
|
||||
public function __invoke(Request $request): InertiaResponse
|
||||
|
@@ -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
|
||||
|
@@ -18,15 +18,14 @@ class ProjectController
|
||||
$this->projectRepository->auth = true;
|
||||
}
|
||||
|
||||
public function edit(Project $project): View
|
||||
public function edit(Project $project): InertiaResponse
|
||||
{
|
||||
return view('dashboard.projects.edit', compact('project'));
|
||||
return inertia('Projects/Edit', compact('project'));
|
||||
}
|
||||
|
||||
public function update(ProjectRequest $request, Project $project): RedirectResponse
|
||||
{
|
||||
$validated = $request->validated();
|
||||
if ($this->projectRepository->update($project, $validated)) {
|
||||
if ($this->projectRepository->update($project, $request->validated())) {
|
||||
return back()->with('message', 'Zaktualizowano projekt!');
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user