I getting results from a query built using Eloquent (Laravel's ORM)
$query = Lawyer::whereHas('user', function($q) use ($request) {
$q->where('is_active', true);
});
$result = $query->get()
I would like to pass the results I get throught a trasformer class LawyerTransformer extends TransformerAbstract{}
to add some data to the results.
When I try this :
$this->collection($query->get(), new LawyerTransformer())
I have the following issue : Method [collection] does not exist.
How can I transform all the results using a transformer ?