/** * Set the claim value, and call a validate method if available * * @param User $value * @throws InvalidClaimException * @return $this */ public function setValue($value) { // Transform the user before encoding $transformerService = App::make(TransformerService::class); $transformer = new EloquentModelTransformer($transformerService); $value = $transformer->transform($value); return parent::setValue($value); }
/** * @param $collection * @return mixed */ public function transformCollection($collection) { /** @var Article[] $collection */ foreach ($collection as $item) { $item->addHidden('content'); } return parent::transformCollection($collection); }
/** * Transform the object into a response entity * @param $object * @return array */ public function transform($object) { $thisTransformation = $this->transformItem($object['token']); return parent::transform($thisTransformation); }