');
- else {
+ } else {
$event->save();
$events = Event::query()->paginate($request->input("limit", 20));
diff --git a/skolehjem/app/Http/Controllers/UserController.php b/skolehjem/app/Http/Controllers/UserController.php
index 86ed353..04cd68f 100644
--- a/skolehjem/app/Http/Controllers/UserController.php
+++ b/skolehjem/app/Http/Controllers/UserController.php
@@ -143,7 +143,7 @@ class UserController extends Controller
if($id === Auth::id() || auth()->user()->hasPermissionTo("user.edit")) {
if ($request->roles != null && auth()->user()->hasPermissionTo("user.edit")) { //You can only edit roles on the admin site, so if there is an input roles, then update user info and edit roles
if(count($allUsersEmail) > 0)
- return redirect()->route('users.edit', ['user' => $id])->with('EmailExists', '
Der findes allerede en bruger med det Telefon Nr.!
');
elseif ($request->password != "") { // If you have edited the password, then run this
@@ -152,7 +152,7 @@ class UserController extends Controller
/** @var User $user */
$user->update($data);
} else // Else go back with an error message
- return redirect()->route("users.edit", ['user' => $id])->with('error#notsamepass', '
Der stod ikke det samme i `Password` & `Confirm Password`!
');
}
//Send email
@@ -290,21 +296,33 @@ class UserController extends Controller
if ($request->input('password') != null) { // If you're editing the password
$data = $request->only(['name_first', 'name_last', 'email', 'phone', 'password']);
if ($request->input('password') != $request->input('confirmpassword')) { // If new password and new password confirm is not the same, go back with fail message.
- return redirect()->route("users.accounteditpass")->with('error#notsamepass', '
Der stod ikke det samme i `Nyt Password` & `Confirm Password`!
');
+ if (request()->cookie('languagesSetting') == "dk")
+ return redirect()->route("users.accounteditpass")->with('error#notsamepass', '
Der stod ikke det samme i `Nyt Password` & `Confirm Password`!
`New Password` & `Confirm Password` was not the same!
');
} elseif (!Hash::check($request->input('oldpassword'), $user->password)) { // If the written current password and current password in DB is not the same, go back with fail message.
- return redirect()->route("users.accounteditpass")->with('error#oldpass', '
Det indtastede password i `Nuværende Password` er ikke dit nuværende password!
');
+ if (request()->cookie('languagesSetting') == "dk")
+ return redirect()->route("users.accounteditpass")->with('error#oldpass', '
Det indtastede password i `Nuværende Password` er ikke dit nuværende password!
The entered `Current Password` was not the same as your current password!
');
} else { // If new password and current password is the same AND current written and current DB password is the same. Then update and logout.
/** @var User $user */
$user->update($data);
Auth::logout();
- return redirect()->route("users.login")->with('success#passwordchange', '
Dit password er hermed ændret!
');
+ if (request()->cookie('languagesSetting') == "dk")
+ return redirect()->route("users.login")->with('success#passwordchange', '
');
}
$users = User::query()->paginate(20);
diff --git a/skolehjem/app/Http/Controllers/UserEventController.php b/skolehjem/app/Http/Controllers/UserEventController.php
index 3dd01f6..500b2a8 100644
--- a/skolehjem/app/Http/Controllers/UserEventController.php
+++ b/skolehjem/app/Http/Controllers/UserEventController.php
@@ -48,15 +48,22 @@ class UserEventController extends Controller
->where('event_id', $request->event_id)->get();
// If the row has both, then go back and show an error - Cause you're not allowed to be on the same event twice.
- if (count($getTableInfo) > 0)
- return redirect()->route("events.index")->with('error#' . $request->event_id, '
Du har allerede tilmeldt dig denne Aktivitet!
');
+ if (count($getTableInfo) > 0) {
+ if (request()->cookie('languagesSetting') == "dk")
+ return redirect()->route("events.index")->with('error#' . $request->event_id, '
');
+ }
// If not, then it keeps going and saves and shows a success message
$UserEvent = new UserEvent($data);
$UserEvent->user_id = auth()->user()->id;
$UserEvent->save();
- return redirect()->back();
+ if (request()->cookie('languagesSetting') == "dk")
+ return redirect()->route("events.index")->with('signup#' . $request->event_id, '