Fixed redirect

This commit is contained in:
frederikpyt
2020-07-01 11:54:33 +02:00
parent b84b9dbe04
commit cd828725b6
2 changed files with 27 additions and 8 deletions
@@ -59,9 +59,14 @@ class WashingMachineController extends Controller
]);
$machine = new WashingMachine($data);
$machine->save();
$saved = $machine->save();
return Response::detect("washing-machines.store");
if(!$saved){
return Response::detect("washing-machines.store");
}else{
$machines = WashingMachine::query()->paginate($request->input("limit", 20));
return Response::detect("washing-machines.index", ['machines' => $machines]);
}
}
/**
@@ -117,7 +122,7 @@ class WashingMachineController extends Controller
return Response::detect("washing-machines.update", [
"machine" => $machine
]);
}else{
} else {
$machines = WashingMachine::query()->paginate($request->input("limit", 20));
return Response::detect("washing-machines.index", [
"machines" => $machines