- add messages
This commit is contained in:
@@ -25,10 +25,12 @@ class ProjectController
|
||||
public function update(ProjectRequest $request, Project $project): RedirectResponse
|
||||
{
|
||||
if ($this->projectRepository->update($project, $request->validated())) {
|
||||
return back()->with('message', 'Zaktualizowano projekt!');
|
||||
return back()
|
||||
->with('success', 'Zaktualizowano projekt!');
|
||||
}
|
||||
|
||||
return back()->withError(['message_error', 'Wystąpił błąd podczas aktualizacji!']);
|
||||
return back()
|
||||
->with(['error', 'Wystąpił błąd podczas aktualizacji!']);
|
||||
}
|
||||
|
||||
public function create(): InertiaResponse
|
||||
@@ -42,10 +44,10 @@ class ProjectController
|
||||
if ($project = $this->projectRepository->create($validated)) {
|
||||
return redirect()
|
||||
->route('admin.project.update', compact('project'))
|
||||
->with('message', 'Utworzono projekt!');
|
||||
->with('success', 'Utworzono projekt!');
|
||||
}
|
||||
|
||||
return back()->withError(['message_error', 'Wystąpił błąd podczas tworzenia!']);
|
||||
return back()->withError(['error', 'Wystąpił błąd podczas tworzenia!']);
|
||||
}
|
||||
|
||||
public function delete(Project $project): InertiaResponse
|
||||
@@ -57,7 +59,9 @@ class ProjectController
|
||||
{
|
||||
$title = $project->title;
|
||||
$project->delete();
|
||||
return redirect()->route('admin.home')->with('message', 'Usunięto projekt "'. $title .'"');
|
||||
return redirect()
|
||||
->route('admin.home')
|
||||
->with('info', 'Usunięto projekt "'. $title .'"');
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user