This commit is contained in:
Neerholt 2020-07-01 09:16:53 +02:00
parent ec2479f0b4
commit 016613b469
2 changed files with 24 additions and 6 deletions

View File

@ -60,9 +60,14 @@ class MenuPlanController extends Controller
]); ]);
$menuPlans = new MenuPlan($requestMenuPlanCreate); $menuPlans = new MenuPlan($requestMenuPlanCreate);
$menuPlans->save(); $saved = $menuPlans->save();
if(!$saved){
return Response::detect("menuplans.store"); return Response::detect("menuplans.store");
}else{
$menuPlans = MenuPlan::query()->paginate($request->input("limit", 20));
return Response::detect("menuplans.index", ['menuplan' => $menuPlans]);
}
} }
/** /**

View File

@ -45,9 +45,16 @@ class rolesController extends Controller
]); ]);
$role = new Role($requestRole); $role = new Role($requestRole);
$role->save(); $saved = $role->save();
if(!$saved){
return Response::detect("roles.store"); return Response::detect("roles.store");
}else{
$roles = Role::query()->paginate($request->input("limit", 20));
return Response::detect("roles.index", ['roles' => $roles]);
}
} }
/** /**
@ -85,9 +92,15 @@ class rolesController extends Controller
$data = $request->all(); $data = $request->all();
$role = Role::find($id); $role = Role::find($id);
$role->update($data); $role->update($data);
$role->save(); $saved = $role->save();
if(!$saved){
return Response::detect("roles.update", [ "role" => $role ]); return Response::detect("roles.update", [ "role" => $role ]);
}else{
$roles = Role::query()->paginate($request->input("limit", 20));
return Response::detect("roles.index", ['roles' => $roles]);
}
} }
/** /**