v1.3.3 - Added comments and removed code

This commit is contained in:
frederikpyt
2020-09-22 08:56:03 +02:00
parent 13197b8be8
commit cc3d78200a
11 changed files with 31 additions and 61 deletions
@@ -46,8 +46,7 @@ class UserEventController extends Controller
]);
// Check the UserEvent table if there is a row that has the user_id AND the event_id
$getTableInfo = UserEvent::where('user_id', auth()->user()->id)
->where('event_id', $request->event_id)->get();
$getTableInfo = UserEvent::where('user_id', auth()->user()->id)->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) {
@@ -81,8 +80,6 @@ class UserEventController extends Controller
public function destroy($id)
{
// Check the UserEvent table if there is a row that has the user_id AND the event_id
//$UserEvent = UserEvent::find($eventid)
$UserEvent = UserEvent::query()->where('user_id', "=", auth()->user()->id)->where('event_id', "=", $id);
$UserEvent->delete();
@@ -101,14 +98,15 @@ class UserEventController extends Controller
{
}
public function edit() {
public function edit()
{
}
public function update() {
public function update()
{
}
//Signs a user up to an event via ajax
public function createajax(Request $request)
{
// Get written data from events.index
@@ -143,6 +141,7 @@ class UserEventController extends Controller
return '<p class="text-center"><b>Du er hermed tilmeldt denne aktivitet!</b></p>';
}
//Removes a users participation in an event via ajax
public function createajaxcancel(Request $request)
{
// Check the UserEvent table if there is a row that has the user_id AND the event_id