Store a newly created resource in storage
POST admin/emailhandling/create

@param  Request   $request
@return Response
187786
public function store(Request $request) {

        // Get a washed array of the create form's input fields
        $data = $this->adminEmailProcessing->washCreateForm($request);

        // Validate the create form's input fields
        $validator = $this->adminEmailProcessing->validateCreateForm($data);

        // Did validate pass or fail?
        if ($validator->fails()) {
            return redirect('admin/emailhandling/create')
                ->withErrors($validator)
                ->withInput()
            ;
        }

        // Populate the fields
        // $data is an array
        $data = $this->adminEmailProcessing->populateCreateFields($data);

        // INSERT the record
        $savedOk = $this->repository->insertNewRecord($data);

        $message     =  "You successfully created your new email message!";

        if ($request->input('send_email') == "Save & Send") {
            $message = "You successfully updated, and sent, your email message!";
        }

        $status_code = 200;

        if (!$savedOk) {
            $message     =  "There was a problem saving your new email message!";
            $status_code = 400;
        }

        Session::flash('message',     $message);
        Session::flash('status_code', $status_code );

        if (!$savedOk) {
            return redirect('admin/emailhandling/create')
                ->withInput()
            ;
        }

        if ($request->input('send_email') == "Save & Send") {

            // send the email
            $this->adminEmailProcessing->sendEmail($data);
        }

        return Redirect::route('admin.emailhandling.index');
    }
745332
public function store(Request $request)
    {
        $user = new \App\User();

        $user->email = $request->email;
        $user->name = $request->name;
        $user->password = Hash::make($request->password);

        $user->save();

        return redirect('scaffold-users');
    }
508873
public function store(Create $request)
    {
        $data = $request->all();

        $this->repository->create($data);

        return $this->redirect('roles.index');
    }
972328
public function store(Request $request)
    {
        if (!$this->can('create-' . Str::plural($this->slug), auth()->user()->id)) {
            abort(404);
        }
        // $this->newRequest = $request->all();

        $this->validation($request);

        $request = $this->HandleRequest($request);

        $model = Laramin::model($this->type->name)->create($request->toArray());

        // $this->relationAfterSaving($request, $model, $this->getInfoOfType(), true);

        Session::flash($this->flashname, $this->SessionMessage("Your {$this->slug} Has Been Succesfully Added", 'success'));

        return redirect()->route('laramin.' . $this->slug . '.index');
    }
915146
public function store(Request $request)
    {
        // Carregar objeto JSON
        $obj = $this->getJsonContent($request);
        if (is_null($obj)) {
            $this->error('JSON invalid', 500);
        }

        // Salvar
        $model = $this->setValues($obj);

        return response()->json($model);
    }
760414
public function store(Request $request)
    {
        // check if user has permissions to access this link
        if(!User::hasAccess('Categories', 'create')) {
            return $this->noPermission();
        }

        $data = $request->all();
        $structuredData =  $this->generateTitleAndSlug($data['form']);
        $form = $structuredData['form'];
        $errors = $structuredData['errors'];

        // return errors if there are any
        if(count($errors)) {
            return $this->response("From errors", 400, null, false, false, true, $errors);
        }

        // if category is being created
        if(!isset($form['categoryID'])) {
            // Order item
            $catCount = Category::where("postTypeID", $request->postTypeID)->count();
            $order = $catCount+1;
            $categoryModel = new Category();
        }else{
            // if category is being updated
            $categoryModel = Category::find($form['categoryID']);
            if(!$categoryModel) {
                return $this->response("Category doesn't exist", 500);
            }
            $order = $categoryModel->order;
            $oldTitle = $categoryModel->setAutoTranslate(false)->title;
        }

        // parent ID
        $parentID = 0;
        if(isset($form['parent']['categoryID'])) {
            $parentID = $form['parent']['categoryID'];
        }

        // Create Category
        $categoryModel->title = $form['title'];
        $categoryModel->postTypeID = $data['postTypeID'];
        $categoryModel->parentID = ($parentID ? $parentID: null);
        $categoryModel->featuredImageID = $form['featuredImageID'];
        $categoryModel->description = $form['description'];
        $categoryModel->slug = $form['slug'];
        $categoryModel->isVisible = $form['isVisible'];
        $categoryModel->order = $order;
        $categoryModel->createdByUserID = Auth::user()->userID;
        $categoryModel->customFields = $request->customFieldValues;

        // return results
        if ($categoryModel->save()) {
            if(isset($form['categoryID'])) {
                // update label in menu link with the category title
                $this->updateMenuLinkLabel($data['id'], $form['title'], $oldTitle);
            }
            $redirect = $this->redirect($request->redirect, $categoryModel->categoryID, $data['postTypeID']);
            $response = $this->response('Category is saved', 200, $redirect['id'], $redirect['view'], $redirect['url']);
        }else{
            $response = $this->response('Category is not saved. Please try again later!', 500);
        }
        return $response;
    }
208709
public function store(Request $request)
    {
        $attributes = request()->validate(PhotoAlbum::$rules, PhotoAlbum::$messages);

        $album = $this->createEntry(PhotoAlbum::class, $attributes);

        return redirect_to_resource();
    }
543508
public function savedetailsAction(Request $request)
    {
        $user = $this->getUser()
            ->setFirstname($request->request->get('firstname'))
            ->setLastname($request->request->get('lastname'))
            ->setEmail($request->request->get('email'));

        $this->get('phlexible_user.user_manager')->updateUser($user);

        return new ResultResponse(true, 'User details saved.');
    }
114868
public function update(Request $request) {

        // Mark this email as read
        $this->repository->markEmailAsRead($request->input('id'));

        // Get a washed array of the create form's input fields
        $data = $this->adminEmailProcessing->washCreateForm($request);

        // Validate the create form's input fields
        $validator = $this->adminEmailProcessing->validateCreateForm($data);

        // Did validate pass or fail?
        if ($validator->fails()) {

            // unlock the record
            $this->repository->unpopulateLockFields($request->input('id'));

            return redirect('admin/emailhandling/'.$request->input('id').'/edit')
                ->withErrors($validator)
                ->withInput()
            ;
        }

        // Populate the fields
        $data = $this->adminEmailProcessing->populateUpdateFields($data);

        // UPDATE the record
        $savedOk = $this->repository->updateNewRecord($data);

        $message =  "You successfully updated your email message!";

        if ($request->input('send_email') == "Save & Send") {
            $message = "You successfully updated, and sent, your email message!";
        }

        $status_code = 200;

        if (!$savedOk) {
            $message     =  "There was a problem updating your email message!";
            $status_code = 400;
        }

        Session::flash('message',     $message);
        Session::flash('status_code', $status_code );

        if (!$savedOk) {

            // unlock the record
            $this->repository->unpopulateLockFields($request->input('id'));

            return redirect('admin/emailhandling/'.$request->input('id').'/edit')
                ->withInput()
            ;
        }


        if ($request->input('send_email') == "Save & Send") {

            // send the email
            $this->adminEmailProcessing->sendEmail($request->input('id'));

            // mark email as sent
            $this->repository->markEmailAsSent($request->input('id'));
        }

        return Redirect::route('admin.emailhandling.index');
    }
193703
public function store(Request $request)
    {
        $this->validate($request, Role::$rules, Role::$messages);

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

        return redirect_to_resource();
    }
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);
    }
1146905
public function store(Request $request)
    {
        // Validate the form data
        $result = $this->validate($request, [
            'email' => 'required|email|max:255|unique:users',
            'password' => 'required|confirmed|min:6',
        ]);

        // Assemble registration credentials and attributes
        $credentials = [
            'email' => trim($request->get('email')),
            'password' => $request->get('password'),
            'first_name' => $request->get('first_name', null),
            'last_name' => $request->get('last_name', null)
        ];
        $activate = (bool)$request->get('activate', false);

        // Attempt the registration
        $result = $this->authManager->register($credentials, $activate);

        if ($result->isFailure()) {
            return $result->dispatch;
        }

        // Do we need to send an activation email?
        if (!$activate) {
            $code = $result->activation->getCode();
            $email = $result->user->email;
            Mail::to($email)->queue(new CentaurWelcomeEmail($email, $code));
        }

        // Assign User Roles
        foreach ($request->get('roles', []) as $slug => $id) {
            $role = Sentinel::findRoleBySlug($slug);
            if ($role) {
                $role->users()->attach($result->user);
            }
        }

        $result->setMessage("User {$request->get('email')} has been created.");
        return $result->dispatch(route('users.index'));
    }
744312
public function store(CreatePermissionRequest $request)
    {
        $input = $request->all();

        $permission = $this->repository->create($input);
        $permission->load($request->getWith());

        return $this->sendResponse($permission, 'Permission saved successfully.');
    }
532089
public function store( Request $request )
    {
        $data = $request->getContent();
        $patientInterface = $this->patientAdapter->toPatientInterface( $data );
        $this->patientRepository->create( $patientInterface );
        // TODO return response code
    }
194462
public function store(Request $request)
    {
        $campagne = $this->campagne->create(['sujet' => $request->input('sujet'), 'auteurs' => $request->input('auteurs'), 'newsletter_id' => $request->input('newsletter_id') ] );

        $this->mailjet->setList($campagne->newsletter->list_id);

        $created = $this->mailjet->createCampagne($campagne); // return Mailjet ID

        if(!$created)
        {
            throw new \designpond\newsletter\Exceptions\CampagneCreationException('Problème avec la création de campagne sur mailjet');
        }

        $this->campagne->update(['id' => $campagne->id, 'api_campagne_id' => $created]);

        alert()->success('Campagne crée');

        return redirect('build/campagne/'.$campagne->id);
    }
167959
public function store(Request $request)
    {
        $createResource = $this->createResourceCallable();
        $resource = new CreateResource($this->serializer);

        $model = $this->getDataModel();
        $data = (array) $request->get('data');
        if (array_key_exists('attributes', $data) && $model->timestamps) {
            $data['attributes'][$model::CREATED_AT] = Carbon::now()->toDateTimeString();
            $data['attributes'][$model::UPDATED_AT] = Carbon::now()->toDateTimeString();
        }

        return $this->addHeaders(
          $resource->get($data, get_class($this->getDataModel()), $createResource)
        );
    }
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();
        }
    }