Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace App\JsonApi\Food;
- use Neomerx\JsonApi\Schema\SchemaProvider;
- class Schema extends SchemaProvider
- {
- /**
- * @var string
- */
- protected $resourceType = 'Food';
- /**
- * @param $resource
- * the domain record being serialized.
- * @return string
- */
- public function getId($resource)
- {
- return $resource->id;
- }
- /**
- * @param $resource
- * the domain record being serialized.
- * @return array
- */
- public function getAttributes($resource)
- {
- // TODO
- return [
- 'name' => $resource->name,
- 'min_price' => $resource->min_price,
- 'food_price' => $resource->food_price,
- 'market_product' => $resource->market_product
- ];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment