/** * @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(); }
/** * {@inheritdoc} */ public function boot() { $this->registerNotificationSerializers(); AbstractSerializeController::setContainer($this->app); AbstractSerializeController::setEventDispatcher($events = $this->app->make('events')); AbstractSerializer::setContainer($this->app); AbstractSerializer::setEventDispatcher($events); }
/** * 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(); }