Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace App\JsonApi\Food;
- use CloudCreativity\LaravelJsonApi\Adapter\AbstractResourceAdapter;
- use CloudCreativity\LaravelJsonApi\Document\ResourceObject;
- use Illuminate\Support\Collection;
- use Modules\Helpers\Entities\Food;
- use Neomerx\JsonApi\Contracts\Encoder\Parameters\EncodingParametersInterface;
- class Adapter extends AbstractResourceAdapter
- {
- /**
- * @inheritDoc
- */
- protected function createRecord(ResourceObject $resource)
- {
- // TODO: Implement createRecord() method.
- }
- /**
- * @inheritDoc
- */
- protected function fillAttributes($record, Collection $attributes)
- {
- // TODO: Implement fillAttributes() method.
- }
- /**
- * @inheritDoc
- */
- protected function persist($record)
- {
- // TODO: Implement persist() method.
- }
- /**
- * @inheritDoc
- */
- protected function destroy($record)
- {
- // TODO: Implement destroy() method.
- }
- /**
- * @inheritDoc
- */
- public function query(EncodingParametersInterface $parameters)
- {
- $foodCollection = Food::loadOneOrMany($parameters->getFilteringParameters());
- return $foodCollection;
- }
- /**
- * @inheritDoc
- */
- public function exists($resourceId)
- {
- // TODO: Implement exists() method.
- }
- /**
- * @inheritDoc
- */
- public function find($resourceId)
- {
- return Food::loadById($resourceId);
- }
- /**
- * @inheritDoc
- */
- public function findMany(array $resourceIds)
- {
- // TODO: Implement findMany() method.
- }
- }
Add Comment
Please, Sign In to add comment