Guest User

Untitled

a guest
Oct 20th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.64 KB | None | 0 0
  1. <?php
  2.  
  3. namespace App\JsonApi\Food;
  4.  
  5. use CloudCreativity\LaravelJsonApi\Adapter\AbstractResourceAdapter;
  6. use CloudCreativity\LaravelJsonApi\Document\ResourceObject;
  7. use Illuminate\Support\Collection;
  8. use Modules\Helpers\Entities\Food;
  9. use Neomerx\JsonApi\Contracts\Encoder\Parameters\EncodingParametersInterface;
  10.  
  11. class Adapter extends AbstractResourceAdapter
  12. {
  13.  
  14.     /**
  15.      * @inheritDoc
  16.      */
  17.     protected function createRecord(ResourceObject $resource)
  18.     {
  19.         // TODO: Implement createRecord() method.
  20.     }
  21.  
  22.     /**
  23.      * @inheritDoc
  24.      */
  25.     protected function fillAttributes($record, Collection $attributes)
  26.     {
  27.         // TODO: Implement fillAttributes() method.
  28.     }
  29.  
  30.     /**
  31.      * @inheritDoc
  32.      */
  33.     protected function persist($record)
  34.     {
  35.         // TODO: Implement persist() method.
  36.     }
  37.  
  38.     /**
  39.      * @inheritDoc
  40.      */
  41.     protected function destroy($record)
  42.     {
  43.         // TODO: Implement destroy() method.
  44.     }
  45.  
  46.     /**
  47.      * @inheritDoc
  48.      */
  49.     public function query(EncodingParametersInterface $parameters)
  50.     {
  51.         $foodCollection = Food::loadOneOrMany($parameters->getFilteringParameters());
  52.         return $foodCollection;
  53.     }
  54.  
  55.     /**
  56.      * @inheritDoc
  57.      */
  58.     public function exists($resourceId)
  59.     {
  60.         // TODO: Implement exists() method.
  61.     }
  62.  
  63.     /**
  64.      * @inheritDoc
  65.      */
  66.     public function find($resourceId)
  67.     {
  68.         return Food::loadById($resourceId);
  69.     }
  70.  
  71.     /**
  72.      * @inheritDoc
  73.      */
  74.     public function findMany(array $resourceIds)
  75.     {
  76.         // TODO: Implement findMany() method.
  77.     }
  78.  
  79. }
Add Comment
Please, Sign In to add comment