Create and return the resource data

@return ResponseBag
519914
public function createResponse()
    {
        // Cannot continue if a resource has not been set
        if (!$this->resource instanceof ResourceInterface) {
            return $this->response;
        }

        return $this->response
            ->setResource($this->resource)
            ->create();
    }
386603
public function createAction()
    {
        // Load form
        $entityClass = $this->getModuleNamespace() . '\Entity\\' . $this->getEntityName();
        $entity      = new $entityClass();
        $form        = $this->getForm('Create' . $this->getEntityName());
        $form->bind($entity);

        // Implement Post/Redirect/Get pattern
        $prg = $this->prg();
        if ($prg instanceof Response) {
            return $prg;
        } else if (false !== $prg) {

            // Set form data
            $form->setData($prg);

            // Create account
            $result = $this->getService()->create();
            if ($result) {
                return $this->redirect()->toRoute($this->indexRoute);
            }
        }

        // Set up view model
        $viewModel = new ViewModel(array(
            'entityName' => $this->getEntityName(),
            'form'       => $form,
        ));
        $viewModel->setTemplate('infinity-base/crud/create');

        return $viewModel;
    }
1153709
public function store()
	{
		$messages = $this->users->validForCreation(
			Input::get('first_name'),
			Input::get('last_name'),
			Input::get('email'),
			Input::get('password')
		);

		if (count($messages) > 0)
		{
			return Response::json($messages->all(), 400);
		}

		return $this->users->create(
			Input::get('first_name'),
			Input::get('last_name'),
			Input::get('email'),
			(bool) Input::get('active'),
			Input::get('password')
		);
	}
102551
public function createAction()
    {
        $success    = null;
        $params     = $this->params();
        $request    = $this->getRequest();
        $type       = $params->fromRoute( 'type' );
        $parent     = $params->fromRoute( 'parentId', null );
        $menu       = $this->getModel()
                           ->create( array(
                                'type' => $type,
                            ) );

        $form = $this->getForm( $menu );

        if ( $request->isPost() )
        {
            $form->setData( $request->getPost() );

            if ( $form->isValid() && $menu->save() &&
                 ( empty( $parent ) || $this->getModel()
                                            ->appendTo( $menu->id, $parent ) ) )
            {
                $success = true;

                $this->messenger()
                     ->add( 'menu.form.success',
                            'menu', Message::LEVEL_INFO );
            }
            else
            {
                $success = false;

                $this->messenger()
                     ->add( 'menu.form.failed',
                            'menu', Message::LEVEL_ERROR );
            }
        }

        return array(
            'success'   => $success,
            'form'      => $form,
            'menu'      => $menu,
        );
    }
726705
public function create()
  {
    $class = ClassGen::classGen(
      $this->name,
      $this->namespace,
      [
        'Phrest\API\Enums\RequestMethodEnum',
        'Phrest\SDK\Request\AbstractRequest',
        'Phrest\SDK\Request\RequestOptions',
        'Phrest\SDK\PhrestSDK'
      ],
      'AbstractRequest'
    );

    // Path
    $path = '/' . $this->version . '/'
      . strtolower($this->entityName)
      . $this->getPlaceholderUriFromUrl($this->action->url);

    $property = ClassGen::property('path', 'private', $path, 'string');
    $class->addPropertyFromGenerator($property);

    // Properties and constructor parameters
    /** @var ParameterGenerator[] $parameters */
    $parameters = [];

    // Get properties
    $getParams = $this->generateGetParamsFromUrl($this->action->url);
    if (!empty($getParams))
    {
      foreach ($getParams as $getParam)
      {
        $class->addPropertyFromGenerator(
          ClassGen::property($getParam, 'public', null)
        );

        $parameter = new ParameterGenerator($getParam);
        $parameter->setDefaultValue(null);

        $parameters[$getParam] = $parameter;
      }
    }

    // Post properties
    if (!empty($this->action->postParams))
    {
      foreach ($this->action->postParams as $name => $type)
      {
        if ($class->hasProperty($name))
        {
          continue;
        }

        $class->addPropertyFromGenerator(
          ClassGen::property($name, 'public', null, $type)
        );

        $parameter = new ParameterGenerator($name, $type);
        $parameter->setDefaultValue(null);

        $parameters[$name] = $parameter;
      }
    }

    // Constructor
    if (!empty($parameters))
    {
      $constructor = ClassGen::constructor($parameters);
      $class->addMethodFromGenerator($constructor);
    }

    // Create method
    $create = ClassGen::method('create', [], 'public', $this->getCreateBody());
    $class->addMethodFromGenerator($create);

    // Setters
    foreach ($parameters as $parameter)
    {
      $class->addMethodFromGenerator(
        ClassGen::setter($parameter->getName(), $parameter->getType())
      );
    }

    return $class;
  }
1017974
protected function createRequest()
    {
        $request = $this->requestFactory->createRequest($this->method, $this->getEndpoint());

        return $this->queryHelper->applyToRequest($request);
    }
569889
public function query()
    {
        $sourceUUID = $this->getSourceUUID();
        if (empty($sourceUUID)) {
            return new JsonResponse([
                'status' => 'Error',
                'message' => 'Source UUID header must be defined',
            ], 400);
        }

        $authorUUID = $this
            ->userCredentialsProvider
            ->getUUID();

        $queryParameterBag = $this
            ->request
            ->query;

        $page = (int) $queryParameterBag->get('page', 1);
        $numPerPage = (int) $queryParameterBag->get('num_per_page', 10);
        $sortBy = json_decode($queryParameterBag->get(
            'sort_by',
            ['created_at' => 'desc']
        ), true);
        $indexedMetadataSortBy = [
            'indexed_metadata.' . key($sortBy) => $sortBy[key($sortBy)],
        ];

        $role = $this->userCredentialsProvider->isModerator()
            ? Author::ROLE_MODERATOR
            : Author::ROLE_USER;

        $result = $this
            ->commentRepository
            ->getCommentsBySource(
                $sourceUUID,
                $page,
                $numPerPage,
                $indexedMetadataSortBy,
                $role
            );

        if (!empty($authorUUID)) {
            foreach ($result->getComments() as $comment) {
                $this->setEditableInComment(
                    $comment,
                    $authorUUID
                );
            }
        }
        
        return new JsonResponse([
            'comments_result' => $result->toArray(),
            'user' => $this->userCredentialsProvider->toArray(),
        ], 200);
    }
302370
public function make()
    {
        if (is_lumen()) {
            return new \Laravel\Lumen\Http\ResponseFactory();
        }

        return app(\Illuminate\Contracts\Routing\ResponseFactory::class);
    }
622245
public function store()
    {
        // Create a new object
        $item = new $this->model;

        // Remove nested model data from input and prepare to insert on save
        $input = (new NestedModels)->relateTo($item);

        // Hydrate the object
        $item->fill($input);

        // Validate and save.
        $this->validate($item);
        if ($this->parent) {
            $this->parent->{$this->parent_to_self}()->save($item);
        } else {
            $item->save();
        }

        // Redirect to edit view
        if (Request::ajax()) {
            return Response::json(['id' => $item->id]);
        } else {
            return Redirect::to(DecoyURL::relative('edit', $item->id))
            ->with('success', $this->successMessage($item, 'created'));
        }
    }
324225
private function getFilesbag()
    {
        static $filesBag = null;

        if (is_null($filesBag)) {
            $filesBag = new FileInput($this->files);
        }

        return $filesBag;
    }
182117
public static function create()
    {
        $request = self::makeRequest();
        $response = self::makeResponse();

        return self::buildProvidersContainer($request, $response);
    }
226076
public function createAction()
    {
        $this->checkAuth($this->resources, $this->modules, AccessManager::CREATE);

        $baseForm = $this->getCreationForm();

        $con = Propel::getConnection();
        $con->beginTransaction();

        try {
            $form = $this->validateForm($baseForm);
            $data = $form->getData();

            $event = $this->getCreationEvent($data);

            $dispatcher = $this->getDispatcher();
            foreach ($this->createEvents as $eventName) {
                $dispatcher->dispatch($eventName, $event);
            }

            $this->afterCreateEvents($event, $data);

            $con->commit();
        } catch (HttpException $e) {
            $con->rollBack();

            return new JsonResponse(["error" => $e->getMessage()], $e->getStatusCode());
        } catch (\Exception $e) {
            $con->rollBack();

            return new JsonResponse(["error" => $e->getMessage()], 500);
        }

        $obj = $this->extractObjectFromEvent($event);
        $id = $this->extractIdFromObject($obj);

        return new JsonResponse(
            $this->getLoopResults(
                array_merge(
                    $this->getRequest()->query->all(),
                    [$this->idParameterName => $id]
                )
            ),
            201
        );
    }
851057
protected function createResourceController()
    {
        Artisan::call('make:controller', [
            'name' => $controller = $this->controllerWithoutMethod($this->action()),
            '--resource' => true
        ]);
        $this->info('Resource Controller ' . $controller .' created.');
        $this->createView($this->argument('link'));
    }
1144156
public function create()
    {
        return $this->makeResponse('create', [
            'file' => [],
            'articles' => Article::when('owner' != user('role'), function ($query) {
                    $query->where('user_id', user('id'));
                })
                ->latest()
                ->get() ?? [],
        ]);
    }
24859
protected function createResourceCallable()
    {
        return function (array $data, array $values, ErrorBag $errorBag) {
            $model = $this->getDataModel()->newInstance();

            foreach ($values as $attribute => $value) {
                $model->setAttribute($attribute, $value);
            }

            if (!empty($data['id'])) {
                $model->setAttribute($model->getKeyName(), $data['id']);
            }

            try {
                $model->save();

                //We need to load the model from the DB in case the user is utilizing getRequiredFields() on the transformer.
                $model = $model->fresh();
            } catch (\Exception $e) {
                $errorBag[] = new Error('creation_error', 'Resource could not be created');
                throw $e;
            }

            return $model;
        };
    }
956364
public function create() : array
    {
        /*
         * Resources
         */
        $this->addResource(self::RES_CATEGORY_MODULE);
        $this->addResource(self::RES_FORM);
        $this->addResource(self::RES_SUMMARY);
        $this->addResource(self::RES_REMOVE);


        /*
         * Privileges
         */
        $this->allow(
            [
                UserAuthorizator::ROLE_EDITOR
            ], [
                self::RES_CATEGORY_MODULE,
                self::RES_FORM,
                self::RES_SUMMARY,
                self::RES_REMOVE
            ]
        );

        return parent::create();
    }
632188
public function create()
    {
        $roles = $this->roleRepositoryInterface->getAll()
                                               ->lists('name', 'slug');

        return $this->view('users.create')
                    ->with('roles', $roles);
    }