Store a newly created resource in storage.

@param  \Illuminate\Http\Request  $request
@return \Illuminate\Http\Response
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');
    }
601188
public function store(Request $request)
    {
        $thread = $this->api('thread.fetch', $request->route('thread'))->parameters(['with' => ['posts']])->get();

        $this->authorize('reply', $thread);

        $post = null;
        if ($request->has('post')) {
            $post = $thread->posts->find($request->input('post'));
        }

        $post = $this->api('post.store')->parameters([
            'thread_id' => $thread->id,
            'author_id' => auth()->user()->getKey(),
            'post_id'   => is_null($post) ? 0 : $post->id,
            'content'   => $request->input('content')
        ])->post();

        $post->thread->touch();

        Forum::alert('success', 'general.reply_added');

        return redirect(Forum::route('thread.show', $post));
    }
185308
public function post(Request $request)
    {
        $this->authorizeUserAction('create');

        $model = new static::$model;

        $this->restfulService->validateResource($model, $request->input());

        $resource = $this->restfulService->persistResource(new $model($request->input()));

        // Retrieve full model
        $resource = $model::with($model::$localWith)->where($model->getKeyName(), '=', $resource->getKey())->first();

        if ($this->shouldTransform()) {
            $response = $this->response->item($resource, $this->getTransformer())->setStatusCode(201);
        } else {
            $response = $resource;
        }

        return $response;
    }
417793
public function store(Request $request)
    {
        $member = Member::findOrFail($request->memberId);
        $this->authorize('attachMemberTagMember', $member);
        /** @noinspection PhpUndefinedMethodInspection */
        $request->validate([
            "memberId" => "exists:" . config('combine-core.tablePrefix', 'combine') . "_members,id",
            "memberTagId" => "exists:" . config('combine-core.tablePrefix', 'combine') . "_member_tags,id",
        ]);
        /** @noinspection PhpUndefinedMethodInspection */
        $member->member_tags()->attach($request->memberTagId);
        return fractal($member, new MemberTransformer())
            ->withResourceName('memberTagMember')
            ->respond();
    }
1372926
public function store(Request $request)
    {
        $type = $request->get('type');

        return $this->manager()->{$type}()->store($request->all());
    }
1349079
public function store(Request $request)
    {
        $package = new Package();

        
        $package->name = $request->name;

        
        $package->description = $request->description;

        
        $package->string_composer = $request->string_composer;
        $package->description_does_what = $request->description_does_what;
        $package->dashboard_URL = $request->dashboard_URL;
        $package->github_URL = $request->github_URL;

        
        
        $package->save();

        return redirect('package');
    }
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;
    }
850107
public function store(Request $request)
    {
        /** @noinspection PhpUndefinedMethodInspection */
        $request->validate([
            'email' => 'required|email',
            'name' => 'max:36',
        ]);
        $invitedMember = $this->createInvitedMember($request);
        $memberInvitation = $this->createMemberInvitation($request->email, $invitedMember->id);
        $invitedMember->notify(new MemberInvited($memberInvitation));
        /** @noinspection PhpUndefinedMethodInspection */
        return fractal($memberInvitation, new MemberInvitationTransformer())
            ->includeInvitedMember()
            ->withResourceName('memberInvitation')
            ->respond();
    }
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');
    }
684407
public function store(Request $request)
    {
        try {
            $field = $this->fields->save($request);
        } catch (Exception $e) {
            return $this->handleException($e, trans('soda::errors.create', ['object' => trans('soda::terminology.field')]));
        }

        return redirect()->route('soda.fields.edit', $field->getKey())->with('success', trans('soda::messages.created', ['object' => trans('soda::terminology.field')]));
    }
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();
        }
    }
1111954
public function store(Request $request)
    {
        $validation = $this->validation->check(File::$rules);

        if (!$validation['errors']) {
            $file = $this->repository->store($request->all());
        } else {
            return $validation['redirect'];
        }

        Cms::notification('File saved successfully.', 'success');

        return redirect(route($this->routeBase.'.files.index'));
    }
1172570
public function store(Request $request)
    {
        /** @noinspection PhpUndefinedMethodInspection */
        $request->validate([
            "memberId" => "exists:" . config('combine-core.tablePrefix', 'combine') . "_members,id",
            "memberTagId" => "exists:" . config('combine-core.tablePrefix', 'combine') . "_member_tags,id",
        ]);
        $memberTag = MemberTag::findOrFail($request->memberTagId);
        $this->authorize('attachMember', [$memberTag, $request->memberId]);
        /** @noinspection PhpUndefinedMethodInspection */
        $memberTag->members()->attach($request->memberId);
        return fractal($memberTag, new MemberTagTransformer())
            ->withResourceName('memberMemberTag')
            ->respond();
    }
925723
public function store(Request $request)
    {
        /** @noinspection PhpUndefinedMethodInspection */
        $request->validate([
            'memberIds.*' => 'required|exists:' . config('combine-core.tablePrefix', 'combine') . '_members,id',
            'memberTagIds.*' => 'required|exists:' . config('combine-core.tablePrefix', 'combine') . '_member_tags,id',
            'locationId' => 'exists:' . config('combine-core.tablePrefix', 'combine') . '_locations,id',
            'start' => 'required|date',
        ]);
        $job = new Job;
        $job->start = Carbon::parse($request->start);
        $job->location_id = $request->locationId;
        $job->team_id = $this->userContext()->team_id;
        $job->save();
        $job->members()->attach($request->memberIds);
        $job->member_tags()->attach($request->memberTagIds);
        return fractal($job, new JobTransformer())
            ->withResourceName('job')
            ->respond();
    }
31152
public function store(Request $request)
    {
        // validate
        $this->registerValidators();

        $validator = Validator::make($request->all(), [
            'route'         => 'required|max:255|string|unique:route_permission,route',
            'permissions'   => 'required|max:255|array|rolePermission',
            'roles'         => 'required|max:255|array|rolePermission'
        ]);

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

        // check current user is admin
        if (!(Auth::user() && Auth::user()->hasRole('admin'))) {
            return response()->json(null, 403);
        }

        // add permissions and roles for the route
        $routePermission = RoutePermission::setRoutePermissionsRoles(
            $request['route'],
            $request['permissions'],
            $request['roles']
        );

        return response()->json(arrayView('phpsoft.users::routePermission/read', [
            'routePermission' => $routePermission
        ]), 201);
    }
32895
public function store(Request $request)
    {
        try {
            $validation = app(ValidationService::class)->check(['location' => 'required']);
            if (!$validation['errors']) {
                foreach ($request->input('location') as $image) {
                    $imageSaved = $this->repository->store([
                        'location' => $image,
                        'is_published' => $request->input('is_published'),
                        'tags' => $request->input('tags'),
                    ]);
                }

                Cms::notification('Image saved successfully.', 'success');

                if (!$imageSaved) {
                    Cms::notification('Image was not saved.', 'danger');
                }
            } else {
                Cms::notification('Image could not be saved', 'danger');

                return $validation['redirect'];
            }
        } catch (Exception $e) {
            Cms::notification($e->getMessage() ?: 'Image could not be saved.', 'danger');
        }

        return redirect(route($this->routeBase.'.images.index'));
    }
1236799
public function store(Request $request)
	{
		$this->authorize('blog',  Auth::user());
    
    	$this->validate($request, Post::storeRules());
    
    	$this->validate($request, Category::storeRules());
    	$this->validate($request, Tag::storeRules());
    	
    	\DB::transaction(function () use ($request){
    		$post = Post::create(Post::storeAttributes($request));
    		
    		$categories = explode(',', $request->categories);
    		// remove empty items from array
    		$categories = array_filter($categories);
    		// trim all the items in array
    		$categories =array_map('trim', $categories);
    		
    		$post->saveCategories($categories);   		 
    		
    		$tags = explode(',', $request->tags);
    		
    		// remove empty items from array
    		$tags = array_filter($tags);
    		// trim all the items in array
    		$tags =array_map('trim', $tags);
    		
    		$post->saveTags($tags);
    		    		
    		
    	});
    	
    
    
    	return redirect(route('blog'));
	}