v0.9.14 - Made an Do you want email slider on settings site

This commit is contained in:
Anders
2020-08-14 10:17:52 +02:00
parent c37645fe85
commit 45d1906497
3 changed files with 75 additions and 2 deletions
@@ -358,6 +358,42 @@ class UserController extends Controller
return redirect()->route("users.index");
}
public function createajax() {
// Check the UserEvent table if there is a row that has the user_id AND the event_id
$User = User::query()->where('id', '=', auth()->user()->id);
// If you are in the Event, then remove yourself.
if (count($User->get()) > 0) {
// If not, then it keeps going and saves and shows a success message
$User->update([ "wants_emails" => true ]);
if (request()->cookie('languagesSetting') == "dk")
return '<p class="text-center"><b>Du får nu mails, når der kommer nyheder!</b></p>';
if (request()->cookie('languagesSetting') == "en")
return "<p class='text-center'><b>You'll now receive a mail when there's news!</b></p>";
return '<p class="text-center"><b>Du får nu mails, når der kommer nyheder!</b></p>';
}
}
public function createajaxcancel() {
// Check the UserEvent table if there is a row that has the user_id AND the event_id
$User = User::query()->where('id', '=', auth()->user()->id);
// If you are in the Event, then remove yourself.
if (count($User->get()) > 0) {
// If not, then it keeps going and saves and shows a success message
$User->update([ "wants_emails" => false ]);
if (request()->cookie('languagesSetting') == "dk")
return '<p class="text-center"><b>Du får ikke mails mere, når kommer nyheder!</b></p>';
if (request()->cookie('languagesSetting') == "en")
return "<p class='text-center'><b>You'll no longer receive a mail when there's news!</b></p>";
return '<p class="text-center"><b>Du får ikke mails mere, når kommer nyheder!</b></p>';
}
}
/*******************************************/
/* Search and settings */
/*******************************************/