44 lines
1023 B
PHP
44 lines
1023 B
PHP
<?php
|
|
|
|
namespace App\JsonApi\Words;
|
|
|
|
use Neomerx\JsonApi\Schema\SchemaProvider;
|
|
|
|
class Schema extends SchemaProvider
|
|
{
|
|
|
|
/**
|
|
* @var string
|
|
*/
|
|
protected $resourceType = 'words';
|
|
|
|
/**
|
|
* @param \App\Word $resource
|
|
* the domain record being serialized.
|
|
* @return string
|
|
*/
|
|
public function getId($resource)
|
|
{
|
|
return (string) $resource->getRouteKey();
|
|
}
|
|
|
|
/**
|
|
* @param \App\Word $resource
|
|
* the domain record being serialized.
|
|
* @return array
|
|
*/
|
|
public function getAttributes($resource)
|
|
{
|
|
return [
|
|
'ulb' => $resource->ulb,
|
|
'greek' => $resource->greek,
|
|
'lemma' => $resource->lemma,
|
|
'morph' => $resource->morph,
|
|
'ognt_sort' => $resource->ognt_sort,
|
|
'strongs_number' => $resource->strongs_number,
|
|
'created-at' => $resource->created_at->toAtomString(),
|
|
'updated-at' => $resource->updated_at->toAtomString(),
|
|
];
|
|
}
|
|
}
|