Store a newly created role in storage.

@param Request $request
@return Response
193703
public function store(Request $request)
    {
        $this->validate($request, Role::$rules, Role::$messages);

        $this->createEntry(Role::class, $request->all());

        return redirect_to_resource();
    }
55342
public function store(Request $request)
    {
        $request = $this->processRequest($request);

        if ($request === true) {
            return $this->redirection();
        }

        $this->validate($request, $this->model->rules());

        $this->model = $this->model->create($request->all());

        $saved = $this->afterSaving($request);

        if ($saved) {
            return $this->redirection();
        }
    }
59640
public function store(Request $request)
    {
//        // handle permission
//        $request = $this->handlePermission(__FUNCTION__, $request);

        // Create Response Model
        $response = new ResponseModel();

        if (!isset($userId)) {
            $userId = 1;
        }

        //add author id into the request if doesn't exist
        if (is_null($request->get('author_id'))) {
            $request['author_id'] = $userId;
        }

        //add user id into the request if doesn't exist
        if (is_null($request->get('user_id'))) {
            $request['user_id'] = $userId;
        }

        $validationErrors = $this->checkRequestValidation($request, $this->storeValidateArray);

        if ($validationErrors != null) {
            if (env('APP_DEBUG', false)) {
                $response->setData(collect($validationErrors->toArray()));
            }
            $response->setMessage($this->getTrans(__FUNCTION__, 'validation_failed'));
            $response->setStatus(false);
            $response->setError(99);
            return SmartResponse::response($response);

        }

        try {
            // get result of model creation
            $result = $this->model->create($request->all());
            // sync many to many relation
            foreach ($this->pivotFields as $pivotField) {
                if (collect($request[$pivotField])->count()) {
                    $pivotField = (new StringHelper())->toCamel($pivotField);
                    $this->model->find($result['id'])->$pivotField()->sync(json_decode($request[$pivotField]));
                }
            }
            $response->setMessage($this->getTrans('store', 'successful'));


            $response->setData($this->model
                ->where($this->model->getKeyName(), $result['id'])
                ->with(collect($this->updateLoad)->count() == 0 ? $this->indexLoad : $this->updateLoad)
                ->get());

            $response->setStatus(true);
        } catch (QueryException $exception) {
            $response->setError($exception->getCode());
            $response->setMessage($this->getTrans('store', 'failed'));
            $response->setStatus(false);
            if (env('APP_DEBUG', false)) {
                $response->setData(collect($exception->getMessage()));
            }
        }
        return SmartResponse::response($response);
    }
22927
public function createAction(Request $request)
    {
        $this->isAllowed('BUSINESS_MANAGE_ROLE');

        $model = new RegistrationRole();
        $form = $this->createCreateForm($model);
        $form->handleRequest($request);

        if ($form->isValid()) {
            $em = $this->getDoctrine()->getManager();

            $selectedApps = array();
            foreach ($model->applications as $selectedApp) {
                $selectedApps[] = $selectedApp->getId();
            }

            foreach ($model->rolesByApplication as $app) {
                if (in_array($app->getId(), $selectedApps)) {
                    $permissions = null === $app->getRole()
                        ? array()
                        : $app->getRole()->getPermissions();

                    $role = new Role();
                    $role->setName($model->role->getName());
                    $role->setApplication($app);
                    $role->setPermissions($permissions);
                    $em->persist($role);
                }
            }

            $em->flush();
            $this->get('session')->getFlashBag()->add('success', 'role.flash.created');

            return $this->redirect($this->generateUrl('sam_role'));
        }

        return $this->render('CanalTPSamEcoreSecurityBundle:Role:new.html.twig', array(
            'entity' => $model,
            'form'   => $form->createView(),
        ));
    }
20960
public function store(Request $request)
    {
        // insert key and value in settings table
        $settings = Settings::all()->keyBy('settingsKey')->toArray();

        foreach ($request->form as $key => $value){
            if(!isset($settings[$key])) {
                $settings[$key] = ["settingsKey" => $key, "value" => $value];
            }
            $settings[$key]['value'] = ($value ? $value : null);
        }

        if(Settings::truncate()) {
            Settings::insert($settings);
        }

        // if request is being made from general settings
        if($request->settingsType == 'general') {
            if(isset($settings['defaultLanguage']) 
                && ((int) $settings['defaultLanguage']['value'] !== Language::getDefault()->languageID)
            ) {
                    // remove the current default language ( set it to non-default ) if this new one is the default
                    Language::where('isDefault', 1)->update(['isDefault' => 0]);
                    // set the new default language
                    $defaultLanguage = $request->form['defaultLanguage'];
                    Language::find($defaultLanguage)->update(['isDefault' => 1]);
            }

        }

        return $this->response('Settings are saved', 200);
    }
964446
public function store(Request $request)
    {
        $data = $request->all();
        $data['resource'] = $data['controller'] . '@' . $data['method'];

        $validator = Validator::make(
            $data,
            $this->getValidationRules()
        );

        if ($validator->fails()) {
            return back()->withInput()->withErrors($validator);
        }

        Permission::create($data);

        return redirect()->action('\Aginev\Acl\Http\Controllers\PermissionController@index')
                         ->with('success', trans('acl::permission.create.created'));
    }
250286
public function store(CreateStorageRequest $request)
    {
        $this->storage->create($request->all());

        return redirect()->route('admin.product.storage.index')
            ->withSuccess(trans('core::core.messages.resource created', ['name' => trans('product::storages.title.storages')]));
    }
1054477
public function store($request)
    {
        $this->fireEvent('creating', [$request]);

        $created = $this->model->create($request);

        $this->fireEvent('created', [$created]);

        return $created;
    }
1167275
public function store(RoleCreateRequest $request)
    {
        $result = $this->service->create($request->except(['_token', '_method']));

        if ($result) {
            return redirect('admin/roles')->with('message', 'Successfully created');
        }

        return back()->with('error', 'Failed to invite');
    }
1163348
public function store(Request $request)
    {
        $this->validate($request, [
            'title' => 'required|max:255',
            'type'  => 'required|max:255|alpha|unique:navigation,type',
        ]);

        $navigation = new Navigation;
        $navigation->fill($request->all());
        $navigation->published = $request->get('published', false);
        $navigation->save();
        flash()->success(trans('cms::navigation.store.success'));

        return redirect()->route('administrator.navigation.index');
    }
575513
public function store(Request $request)
    {
        $this->authorize('create', Permission::class);

        if (str_replace(' ', '', $request->slug) != $request->slug) {
            return redirect()->back()->withInput()->with('error', __('laralum_permissions::general.slug_cannot_contain_spaces'));
        }
        $this->validate($request, [
            'name'        => 'required|max:255',
            'slug'        => 'required|max:255|unique:laralum_permissions',
            'description' => 'required|max:500',
        ]);

        Permission::create($request->all());

        return redirect()->route('laralum::permissions.index')->with('success', __('laralum_permissions::general.permission_added'));
    }
589415
public function store(CreateUserRequest $request)
    {
        $this->user->createWithRoles($request->all(), $request->roles);

        flash(trans('core::messages.resource.resource created', ['name' => trans('user::users.title.user')]));

        return redirect()->route('backend::user.user.index');
    }
574837
public function store(Request $request)
    {
        $menuParentItem = Menu::whereIsRoot()->first();
        $menu = $menuParentItem->children()->create([
            'name'   => trans('menu::menu.node.new item'),
            'active' => true,
        ]);

        return $this->response()->item($menu, new NodeTransformer());
    }
839069
public function store(Request $request)
    {
        $query = $this->getQuery();

        try {
            if ($request->input('query')) {
                $filter = new Filter($this->manager->newEntity()->getTable(), $this->queryable);
                $filter->build($query, $request->input('query'));
            }
        } catch (QuerySyntaxException $e) {
            return $this->error(['code' => 'QUERY_SYNTAX_ERROR', 'message' => 'Syntax error']);
        }

        $params = $request->only($this->fillable);

        DB::beginTransaction();

        $result = new Result();

        $query->chunk(100, function ($resources) use ($params, &$result) {
            foreach ($resources as $resource) {
                $result->addErrors($this->getManager()->update($resource, $params)->getErrors());
            }
        });

        if (!$result->ok()) {
            DB::rollBack();

            return $this->response(['errors' => $result->getSimpleErrors()], Response::HTTP_BAD_REQUEST);
        }

        DB::commit();

        return $this->response(null, Response::HTTP_OK);
    }
777051
public function store(Request $request)
    {
        $this->validate($request, [
            'author_id' => ['required', 'integer'],
            'title'     => ['required'],
            'content'   => ['required']
        ]);

        $category = Category::find($request->input('category_id'));

        $this->authorize('createThreads', $category);

        if (!$category->threadsEnabled) {
            return $this->buildFailedValidationResponse($request, trans('forum::validation.category_threads_enabled'));
        }

        $thread = $this->model()->create($request->only(['category_id', 'author_id', 'title']));
        Post::create(['thread_id' => $thread->id] + $request->only('author_id', 'content'));

        return $this->response($thread, 201);
    }
1215980
public function store(Request $request)
    {
        // check if user has permissions to access this link
        if(!User::hasAccess('Media', 'create')) {
            return $this->noPermission();
        }
        return (new Media())->upload($request);
    }
464075
public function store(RoleRequest $request)
    {
        $role = Role::create($request->all());

        $role->setPermissions($request->permissions);

        return 200;
    }