Fix
This commit is contained in:
parent
b929aa2bdb
commit
7b4610f02f
|
@ -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]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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 ]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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">
|
||||
|
|
Loading…
Reference in New Issue