Create an Resource and Returns a Json Resrouce for that Record

@return \Illuminate\Http\Resources\Json\JsonResource
345192
public function store(CategoryRequest $request)
    {
        $category = Category::create($request->all());

        return (new CategoryResource($category));
    }
1106725
public function getResource(): object
    {
        \mysqli_report(MYSQLI_REPORT_ALL);

        return new mysqli(
            $this->options['host'],
            $this->options['user'],
            $this->options['password'],
            $this->options['database'],
            $this->options['port']
        );
    }
879323
public function getJsonResource()
    {

        $result = $this->getGuzzle()->request('GET',
            'https://raw.githubusercontent.com/eveseat/resources/master/sde.json', [
                'headers' => ['Accept' => 'application/json'],
            ]);

        if ($result->getStatusCode() != 200)
            return json_encode([]);

        return json_decode($result->getBody());
    }
703839
private function createSerializer()
    {
        return SerializerBuilder::create()
            ->setPropertyNamingStrategy(new IdenticalPropertyNamingStrategy())
            ->configureListeners(function (EventDispatcher $dispatcher) {
                $dispatcher->addListener('serializer.post_deserialize',
                    function (ObjectEvent $event) {
                        $object = $event->getObject();
                        if ($object instanceof ClientAwareInterface) {
                            $object->setClient($this);
                        }
                    }
                );

                $dispatcher->addListener('serializer.post_serialize',
                    function (ObjectEvent $event) {
                        $options = $event->getContext()->attributes->get('options')->getOrElse(array());
                        $visitor = $event->getVisitor();

                        if ($visitor instanceof GenericSerializationVisitor) {
                            foreach ($options as $key => $value) {
                                $visitor->addData($key, $value);
                            }
                        }
                    }
                );
            })
            ->build();
    }
558606
private function create()
    {
        $response = $this->sendRequest(
            self::METHOD_POST,
            self::$endPoints['create'],
            $this->requestData
        );
        $this->resetRequestData();
        return $response;
    }
720951
def create(self, *args, **kwargs):
        """"""
        resource = super(JsonServerResource, self).create(*args, **kwargs)

        return ResourceResult(
            body=resource,
            status=get_http_status_code_value(http.client.CREATED),
            location="{}/{}".format(request.url, resource.get_id())
        )
735356
protected function createResource(): \Imi\Pool\Interfaces\IPoolResource
    {
        $config = $this->getNextResourceConfig();
        return new DbResource($this, BeanFactory::newInstance($config['dbClass'] ?? \Imi\Db\Drivers\PdoMysql\Driver::class, $config));
    }
907616
public function build(): ReplayXHRRequest
	{
		$instance = new ReplayXHRRequest();
		if ($this->requestId === null) {
			throw new BuilderException('Property [requestId] is required.');
		}
		$instance->requestId = $this->requestId;
		return $instance;
	}
625671
private function createResource(callable $callback)
	{
		// Turn off error reporting while we try to initiate the request
		$level = error_reporting(0);
		$resource = call_user_func($callback);
		error_reporting($level);

		// If the resource could not be created, then grab the last error and
		// throw an exception.
		if (!is_resource($resource)) {
			$message = 'Error creating resource: ';
			foreach ((array) error_get_last() as $key => $value) {
				$message .= "[{$key}] {$value} ";
			}
			throw new \Exception(trim($message));
		}

		return $resource;
	}
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;
  }
817545
public function save()
    {
        // Find record if we have an ID, otherwise create a new record
        $user = (Input::get('id')) ? User::with('addresses')->find(Input::get('id')) : new User;
        $result = $user->saveRecursive();

        // Capture errors to return via JSON model if we have some
        if ( ! $result) $user->errors = $user->getErrors();

        return $user;
    }
621507
public function getResourceLink()
    {

        if (is_null($this->resourceLink) && !is_null($this->resourceLinkId)) {
            $this->resourceLink = ResourceLink::fromRecordId($this->resourceLinkId, $this->getDataConnector());
        }

        return $this->resourceLink;

    }
988200
public function store()
    {
        if (!Input::has('user')) {
            return $this->jsonErrorResponse('"user" is required.');
        }

        $user = Subbly::api('subbly.user')->create(Input::get('user'));

        return $this->jsonResponse(array(
            'user' => $this->presenter->single($user),
        ),
        array(
            'status' => array(
                'code'    => 201,
                'message' => 'User created',
            ),
        ));
    }
1264359
function get()
    {
        $result = $this->client->get($this->requestDecorator->makeResource(), $this->requestDecorator->makeQuery());
        $this->refresh();
        return $result;
    }
710024
private function createFile()
    {
        $file = fopen($this->storage, "w");
        fputs($file, '{}');
        fclose($file);
        return json_decode('{}');
    }
199475
public function getResource()
    {
        if ($this->_resource === null) {
            $this->_resource = $this->toResource();
        }
        return $this->_resource;
    }
297869
private function getJsonStorage()
    {
        if (!$this->jsonStorage) {
            $this->jsonStorage = new JsonStorage(
                $this->getStorage(),
                new JsonConverterProvider($this),
                $this->getJsonEncoder(),
                $this->getJsonDecoder(),
                $this->getFactoryManager()
            );
        }

        return $this->jsonStorage;
    }