Fix up Show endpoint callbacks
This commit is contained in:
parent
1e1fc4cdb3
commit
8029c6fd4a
|
|
@ -38,11 +38,13 @@ class Show
|
||||||
|
|
||||||
public function handle(Context $context): ResponseInterface
|
public function handle(Context $context): ResponseInterface
|
||||||
{
|
{
|
||||||
|
run_callbacks($this->resource->getSchema()->getListeners('showing'), [&$this->model, $context]);
|
||||||
|
|
||||||
$include = $this->getInclude($context);
|
$include = $this->getInclude($context);
|
||||||
|
|
||||||
$this->loadRelationships([$this->model], $include, $context);
|
$this->loadRelationships([$this->model], $include, $context);
|
||||||
|
|
||||||
run_callbacks($this->resource->getSchema()->getListeners('show'), [&$this->model, $context]);
|
run_callbacks($this->resource->getSchema()->getListeners('shown'), [&$this->model, $context]);
|
||||||
|
|
||||||
$serializer = new Serializer($this->api, $context);
|
$serializer = new Serializer($this->api, $context);
|
||||||
$serializer->add($this->resource, $this->model, $include);
|
$serializer->add($this->resource, $this->model, $include);
|
||||||
|
|
|
||||||
|
|
@ -220,7 +220,7 @@ final class Type
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run a callback when a resource is shown.
|
* Run a callback after a resource is shown.
|
||||||
*/
|
*/
|
||||||
public function onShown(callable $callback): void
|
public function onShown(callable $callback): void
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue