Am using fractal package from phpleague. I have a transform class setup like this
class ConversationTransformer extends TransformerAbstract
{
class ConversationTransformer extends TransformerAbstract
{
private $params = [];
function __construct($params = [])
{
$this->params = $params;
}
public function transform (Conversation $conversation)
{
//-- $this->params will be used here
return [];
}
}
Call it with this return:
return $this->fractal->paginatedCollection($conversations, new ConversationTransformer(['user' => $user]))