Adjust class file controller
This commit is contained in:
1 parent
4471b5e509
commit
ac5fdc3909
4 files changed
+18
-20
No files matched your search
@@ -34,7 +34,7 @@ class WordsController extends Controller
|
||||
$word->translation = $request->translation;
|
||||
$word->save();
|
||||
|
||||
return redirect('/words');
|
||||
return redirect('/words')->withSuccess('The Italian word and its translation have been successfully saved.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -78,7 +78,7 @@ class WordsController extends Controller
|
||||
$data->save();
|
||||
|
||||
// Redirect to a success route or return a success message
|
||||
return redirect('/words');
|
||||
return redirect('/words')->withSuccess('The Italian word and its translation has been successfully changed.');
|
||||
} else {
|
||||
// Unique constraint violated
|
||||
return back()->withInput()->withErrors(['name' => 'Error: words already exists']);
|
||||
@@ -91,6 +91,6 @@ class WordsController extends Controller
|
||||
public function delete($id): RedirectResponse
|
||||
{
|
||||
Word::destroy($id);
|
||||
return redirect('/words');
|
||||
return redirect('/words')->withSuccess('The Italian word and its translation has been successfully deleted.');
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user