This commit is contained in:
Neerholt 2020-07-01 09:43:11 +02:00
parent b929aa2bdb
commit 7b4610f02f
4 changed files with 42 additions and 12 deletions

View File

@ -59,9 +59,15 @@ class EventController extends Controller
$event = new Event($requestBody);
$event->save();
$saved = $event->save();
if(!$saved){
return Response::detect("events.store");
}else{
$event = Event::query()->paginate($request->input("limit", 20));
return Response::detect("events.index", ['events' => $event]);
}
return Response::detect("events.store");
}
/**
@ -100,9 +106,15 @@ class EventController extends Controller
$event = Event::find($id);
$event->update($data);
$event->save();
$saved = $event->save();
if(!$saved){
return Response::detect("events.update", [ "event" => $event]);
}else{
$event = Event::query()->paginate($request->input("limit", 20));
return Response::detect("events.index", ['events' => $event]);
}
return Response::detect("events.update", [ "event" => $event]);
}
/**

View File

@ -55,9 +55,15 @@ class ExternalLinkController extends Controller
]);
$externalLink = new ExternalLink($requestBody);
$externalLink->save();
$saved = $externalLink->save();
if(!$saved){
return Response::detect("external-links.store");
}else{
$externalLink = ExternalLink::query()->paginate($request->input("limit", 20));
return Response::detect("external-links.index", ['links' => $externalLink]);
}
return Response::detect("external-links.store");
}
/**
@ -96,9 +102,15 @@ class ExternalLinkController extends Controller
$link = ExternalLink::find($id);
$link->update($data);
$link->save();
$saved = $link->save();
if(!$saved){
return Response::detect("external-links.update", [ "link" => $link]);
}else{
$externalLink = ExternalLink::query()->paginate($request->input("limit", 20));
return Response::detect("external-links.index", ['links' => $externalLink]);
}
return Response::detect("external-links.update", [ "link" => $link]);
}
/**

View File

@ -66,7 +66,7 @@ class MenuPlanController extends Controller
return Response::detect("menuplans.store");
}else{
$menuPlans = MenuPlan::query()->paginate($request->input("limit", 20));
return Response::detect("menuplans.index", ['menuplan' => $menuPlans]);
return Response::detect("menuplans.index", ['menuPlans' => $menuPlans]);
}
}
@ -107,9 +107,15 @@ class MenuPlanController extends Controller
$menuplan = MenuPlan::find($id);
$menuplan->update($data);
$menuplan->save();
$saved = $menuplan->save();
if(!$saved){
return Response::detect("menuplans.update", [ "menuplan" => $menuplan ]);
}else{
$menuPlans = MenuPlan::query()->paginate($request->input("limit", 20));
return Response::detect("menuplans.index", ['menuPlans' => $menuPlans]);
}
return Response::detect("menuplans.update", [ "menuplan" => $menuplan ]);
}
/**

View File

@ -15,7 +15,7 @@
@csrf
@method("PUT")
<label for="title">Titel:</label>
<input value="{{$link->name}}" type="text" name="title" id="title" required>
<input value="{{$link->name}}" type="text" name="name" id="title" required>
<label for="link">Linket:</label>
<input value="{{$link->link}}" type="text" name="link" id="link" required>
<input type="submit" class="btn btn-dark text-white" value="Rediger">