Backend\UserGroupsController::store PHP Method

store() public method

Store a newly created user groups in storage.
public store ( ) : Response
return Response
    public function store()
    {
        try {
            $input = Input::all();
            $validator = Group::validate($input);
            if ($validator->passes()) {
                $group = $this->usergroup_manager->createUserGroup($input);
                return Redirect::to('backend/user-groups')->with('success_message', trans('success_messages.user_group_create', ['usergroup' => $input['name']]));
            } else {
                // Form validation failed
                return Redirect::back()->withInput()->withErrors($validator);
            }
        } catch (Exception $e) {
            return Redirect::back()->with('error_message', trans('error_messages.user_group_create', ['usergroup' => $input['name']]) . $e->getMessage());
        }
    }