Adjust class file controller
This commit is contained in:
@@ -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