Inheritance: extends Tobscure\JsonApi\AbstractSerializer
Exemplo n.º 1
0
 /**
  * @param AbstractSerializer $serializer The class doing the serializing.
  * @param object|array $model The model being serialized.
  * @param array $attributes The serialized attributes of the resource.
  */
 public function __construct(AbstractSerializer $serializer, $model, array &$attributes)
 {
     $this->serializer = $serializer;
     $this->model = $model;
     $this->attributes =& $attributes;
     $this->actor = $serializer->getActor();
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function boot()
 {
     $this->registerNotificationSerializers();
     AbstractSerializeController::setContainer($this->app);
     AbstractSerializeController::setEventDispatcher($events = $this->app->make('events'));
     AbstractSerializer::setContainer($this->app);
     AbstractSerializer::setEventDispatcher($events);
 }
Exemplo n.º 3
0
 /**
  * Get the result of an API request to show the current user.
  *
  * @return array
  */
 protected function getUserDocument(Request $request)
 {
     $actor = $request->getAttribute('actor');
     $this->userSerializer->setActor($actor);
     $resource = new Resource($actor, $this->userSerializer);
     $document = new Document($resource->with('groups'));
     return $document->toArray();
 }