diff --git a/skolehjem/app/Http/Controllers/FeedbackController.php b/skolehjem/app/Http/Controllers/FeedbackController.php index 3bb9211..bc15970 100644 --- a/skolehjem/app/Http/Controllers/FeedbackController.php +++ b/skolehjem/app/Http/Controllers/FeedbackController.php @@ -166,5 +166,15 @@ class FeedbackController extends Controller } } + public function storeajax(Request $request) { + $requestBody = $request->validate([ + "message" => "required", + "suggestion_form" => "required|max:255" + ]); + + $feedbacks = new Feedbacks($requestBody); + $feedbacks->save(); + } + } diff --git a/skolehjem/resources/lang/dk/msg.php b/skolehjem/resources/lang/dk/msg.php index da07a73..bb30c98 100644 --- a/skolehjem/resources/lang/dk/msg.php +++ b/skolehjem/resources/lang/dk/msg.php @@ -65,10 +65,7 @@ return[ "error" => "Fejl", "404" => "Denne side findes ikke.", "403" => "Du har ikke rettigheder til denne side.", - "canceled" => "Aflyst" - - - - - + "canceled" => "Aflyst", + "feedbacksendt" => "Tak for din feedback!", + "feedbackerror" => "Du skal skrive en besked." ]; diff --git a/skolehjem/resources/lang/en/msg.php b/skolehjem/resources/lang/en/msg.php index 87ebfc8..d75823c 100644 --- a/skolehjem/resources/lang/en/msg.php +++ b/skolehjem/resources/lang/en/msg.php @@ -71,5 +71,7 @@ return[ "error" => "Error", "404" => "This page doesn't exist.", "403" => "You don't have permissions to access this page.", - "canceled" => "Canceled" + "canceled" => "Canceled", + "feedbacksendt" => "Thank you for your feedback!", + "feedbackerror" => "You have to write a feedback message." ]; diff --git a/skolehjem/resources/views/app/feedbacks/create.blade.php b/skolehjem/resources/views/app/feedbacks/create.blade.php index 91e4a25..7f0c9ad 100644 --- a/skolehjem/resources/views/app/feedbacks/create.blade.php +++ b/skolehjem/resources/views/app/feedbacks/create.blade.php @@ -11,15 +11,49 @@ }
-
+
@csrf Ris el. Ros? - - - - + Besked: + + +
+
@endsection +@section("scripts") + +@endsection diff --git a/skolehjem/routes/web.php b/skolehjem/routes/web.php index 1c595b5..e3de331 100644 --- a/skolehjem/routes/web.php +++ b/skolehjem/routes/web.php @@ -40,6 +40,7 @@ Route::get("/about", "AboutController@index")->name("about.index"); Route::post("/events/cancelsignup", "UserEventController@createajaxcancel")->name("userevents.createajaxcancel"); Route::post("/account/cancelmailwants", "UserController@createajaxcancel")->name("users.createajaxcancel"); Route::delete("/notifications/delete", "EventController@deleteNotifications")->name("notifications.delete"); +Route::post("/feedbacks/store", "FeedbackController@storeajax")->name("feedbacks.storeajax"); //Route::get("/signup", "UserController@signup")->name("users.signup"); //Search/Filter