Store a newly created news in storage.

@param Request $request
@return array
352762
public function store(Request $request)
    {
        if (is_null(request()->file('media'))) {
            $attributes = request()->validate(array_except(PageContent::$rules, 'media'),
                PageContent::$messages);
        }
        else {
            $attributes = request()->validate(PageContent::$rules, PageContent::$messages);

            $media = $this->moveAndCreatePhoto($attributes['media']);
            if ($media) {
                $attributes['media'] = $media;
            }
        }

        $pageContent = $this->createEntry(PageContent::class, $attributes);

        return redirect('admin/pages/'.$request->page_id.'/sections/content/'.$pageContent->id.'/edit');
    }
975646
public function store(Request $request)
    {
        // Validate the form data
        $result = $this->validate($request, [
            'name' => 'required',
            'slug' => 'required|alpha_dash|unique:roles',
        ]);

        // Create the Role
        $role = Sentinel::getRoleRepository()->createModel()->create([
            'name' => trim($request->get('name')),
            'slug' => trim($request->get('slug')),
        ]);

        // Cast permissions values to boolean
        $permissions = [];
        foreach ($request->get('permissions', []) as $permission => $value) {
            $permissions[$permission] = (bool)$value;
        }

        // Set the role permissions
        $role->permissions = $permissions;
        $role->save();

        // All done
        if ($request->expectsJson()) {
            return response()->json(['role' => $role], 200);
        }

        session()->flash('success', "Role '{$role->name}' has been created.");
        return redirect()->route('roles.index');
    }
1251245
public function dashboardNews(Request $request)
    {
        $news = $this->getNews($request->getHost());

        // One 'alert' and one 'info' max. Regular info-items can be disabled,
        // but Alerts can't.
        $context = [
            'alert'       => empty($news['alert']) ? null : $news['alert'],
            'news'        => empty($news['news']) ? null : $news['news'],
            'information' => empty($news['information']) ? null : $news['information'],
            'error'       => empty($news['error']) ? null : $news['error'],
            'disable'     => $this->getOption('general/backend/news/disable'),
        ];

        $response = $this->render('@bolt/components/panel-news.twig', ['context' => $context]);

        return $response;
    }
174275
public function store(Request $request)
  {
    Permission::create($request->all());
    \Session::flash('flash_message', 'Permission added!');
    return \Redirect::route('api.v1.permissions.index', [
      ])->withMessage(trans('acl::permission.permissions-controller-successfully_created'));
    }
315373
public function putCollectionAction(Request $request)
    {
        $result = [];
        foreach ($request->request->all() as $data) {
            if (!isset($data['type']) || !isset($data['uid'])) {
                throw new BadRequestHttpException("type and/or uid is missing.");
            }

            try {
                $content = $this->updateClassContent($data['type'], $data['uid'], $data);
                $this->granted('VIEW', $content);
                $this->granted('EDIT', $content);

                $result[] = [
                    'uid'        => $content->getUid(),
                    'type'       => $content->getContentType(),
                    'statusCode' => 200,
                    'message'    => 'OK',
                ];
            } catch (AccessDeniedException $e) {
                $result[] = [
                    'uid'        => $data['uid'],
                    'type'       => $data['type'],
                    'statusCode' => 401,
                    'message'    => $e->getMessage(),
                ];
            } catch (\Exception $e) {
                $result[] = [
                    'uid'        => $data['uid'],
                    'type'       => $data['type'],
                    'statusCode' => 500,
                    'message'    => $e->getMessage(),
                ];
            }
        }

        $this->getEntityManager()->flush();

        return $this->createJsonResponse($result);
    }
461266
public function store(Request $request)
    {
        /** @noinspection PhpUndefinedMethodInspection */
        $request->validate([
            "name" => "required|max:75",
            "email" => "required|email|max:75|unique:users",
        ]);
        $user = new User;
        $user->name = $request->get("name");
        $user->email = $request->get("email");
        $user->save();
        return response()->json($user, 201);
    }
207897
protected function prepareRequestToBeCopied(Request $request)
    {
        $remove = [];
        if ($request->method() === 'POST' && $request->input('next_action') === 'save_and_create') {
            if (! $this->copyAfterSave) {
                $remove[] = $this->relationName;
            }
            $this->makeCopyOfRelations($request);
        }

        return $request->replace($request->except($remove));
    }
137954
public function newAction(Request $request)
    {
        $stream = $this->get('oktolab_media_stream')->createStream();
        $form = $this->createForm(StreamType::class, $stream);
        $form->add(
            'submit',
            SubmitType::class,
            [
                'label' => 'oktolab_media.new_stream_button',
                'attr' => ['class' => 'btn btn-primary']
            ]
        );

        if ($request->getMethod() == "POST") {
            $form->handleRequest($request);
            if ($form->isValid()) {
                $em = $this->getDoctrine()->getManager();
                $em->persist($stream);
                $em->flush();

                $this->get('session')->getFlashBag()->add(
                    'success',
                    'oktolab_media.success_create_stream'
                );

                return $this->redirect(
                    $this->generateUrl(
                        'oktolab_media_stream_show',
                        ['uniqID' => $stream->getUniqID()]
                    )
                );
            } else {
                $this->get('session')->getFlashBag()->add(
                    'error',
                    'oktolab_media.error_create_stream'
                );
            }
        }

        return ['form'   => $form->createView()];
    }
71456
public function store(Request $request)
    {
        $this->validation->make($request->all(), [
            'name' => 'required|max:255',
            'redirect' => ['required', $this->redirectRule],
        ])->validate();

        return $this->clients->create(
            $request->user()->getKey(), $request->name, $request->redirect
        )->makeVisible('secret');
    }
570715
public function store(Request $request)
    {
        try {
            $contentType = $this->contentTypes->save($request);
        } catch (Exception $e) {
            return $this->handleException($e, trans('soda::errors.create', ['object' => trans('soda::terminology.content_type')]));
        }

        return redirect()->route('soda.content-types.edit', $contentType->getKey())->with('success', trans('soda::messages.created', ['object' => trans('soda::terminology.content_type')]));
    }
576566
public function store(Request $request)
    {
        $validator = Validator::make($request->all(), [
            'name'       => 'required|string|max:255',
            'email'      => 'required|email|max:255|unique:users',
            'password'   => 'required|string|confirmed|min:6',
            'username'   => 'string|max:30',
            'country'    => 'string|max:100',
            'location'   => 'string|max:100',
            'biography'  => 'string|max:255',
            'occupation' => 'string|max:255',
            'website'    => 'string|max:255',
            'image'      => 'string|max:255',
            'gender'     => 'integer',
            'birthday'   => 'date'
        ]);

        if ($validator->fails()) {
            return response()->json(arrayView('phpsoft.users::errors/validation', [
                'errors' => $validator->errors()
            ]), 400);
        }

        $user = AppUser::create($request->all());

        return response()->json(arrayView('phpsoft.users::user/read', [
            'user' => $user
        ]), 201);
    }
1153994
public function store(Request $request)
    {
        // check if user has permissions to access this link
        if(!User::hasAccess('Tags', 'create')) {
            return $this->noPermission();
        }

        $validatorData = [
            'title' => 'required',
            'postTypeID' => 'required',
            'slug' => 'required|max:500|unique:tags',
        ];

        if(isset($request->formData['id'])) {
            // Update Tag
            $tags = Tag::findOrFail($request->formData['id']);
            $validatorData['slug'] = 'required';
        }else{
            $tags = new Tag();
            $tags->createdByUserID = Auth::user()->userID;
            $tags->postTypeID = $request->formData['postTypeID'];
        }

        // validation
        $validator = Validator::make($request->formData, $validatorData, []);
        // check validation
        if ($validator->fails()) {
            return $this->response("Please check all required fields!", 400, null, false, false, true, $validator->errors());
        }

        $tags->title         = $request->formData['title'];
        $tags->description   = $request->formData['description'];
        $tags->slug          = $request->formData['slug'];
        $tags->featuredImageID = ($request->formData['featuredImage']  !== 0 ? $request->formData['featuredImage'] : null);

        // return results
        if ($tags->save()) {
            $redirect = $this->redirect($request->formData['redirect'], $tags->tagID, $request->formData['postTypeID']);
            $result = $this->response('Tag is saved', 200, $redirect['id'], $redirect['view'], $redirect['url']);
        }else{
            $result = $this->response('Internal server error. Please try again later', 500);
        }
        return $result;
    }
590001
public function store(Request $request)
    {
        $validator = Validator::make($request->all(), [
            'name'         => 'required|string|max:255|unique:permissions',
            'display_name' => 'string|max:255',
            'description'  => 'max:1000'
        ]);

        if ($validator->fails()) {
            return response()->json(arrayView('phpsoft.users::errors/validation', [
                'errors' => $validator->errors()
            ]), 400);
        }

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

        return response()->json(arrayView('phpsoft.users::permission/read', [
            'permission' => $permission
        ]), 201);
    }
380323
public function store(Request $request)
    {
        $postdata = $request->all();

        //Setting the validation rules
        $validationRules = [
            'first_name' => 'required|max:15',
            'last_name' => 'required|max:15',
            'email_address' => 'required|email|unique:users',
            'password' => 'required|min:6',
            'password_confirmation' => 'required|min:6|same:password'
        ];

        //Checking the validation rules
        $validation = $this->userValidation($postdata, $validationRules);

        /**
         * If the validation rules fail then validation message will stored in log file
         * then a message will stored in session
         * and redirect to same page with errors message
         */
        if ($validation->fails()) {
            Log::error('From Validation Error Occurs', ['validation-error' => $validation->messages()]);
            \Session::flash('error', 'Sorry, Something went wrong');
            return redirect()->back()
                ->withInput($postdata)
                ->withErrors(
                    $validation->messages()
                );
        }

        try {
            $userModel = new UserModel();
            $isCreated = $userModel->createUser($request);
            if ($isCreated == true) {
                Log::error('UserModel has been created successfully', ['postdata' => $postdata]);
                \Session::flash('success', 'UserModel has been created successfully');

                return redirect('/');
            } else {
                \Session::flash('warning', 'Sorry, No changes found');
            }
        } catch (\Exception $exception) {
            Log::error('ERROR', [$exception->getTraceAsString()]);
            Log::debug('DEBUG', [$exception->getTraceAsString()]);
        }
    }
889881
private function getContentFromRequest(Request $request): array
    {
        $data = json_decode($request->getContent(), true);
        foreach ($data as $key => $value) {
            if ($value === null || $value === '') {
                unset($data[$key]);
            }
        }
        return $data;
    }
824365
public function store(Request $request)
	{
		$attributes = request()->validate(Settings::$rules, Settings::$messages);

        $setting = $this->createEntry(Settings::class, $attributes);

        log_activity('Setting Created', 'A Setting was successfully created', $setting);

        return redirect_to_resource();
	}
374212
public function get_update_datas(Request $request)
    {
        $datas = [
            'title'       => $request->get('modif_title'),
            'description' => $request->get('modif_description'),
            'category'    => $request->get('modif_category'),
            'tags'        => $request->get('modif_tags'),
            'privacy'     => $request->get('modif_privacy'),
        ];

        return $datas;
    }