ledgerrz/app/Http/Resources/DynamicResource.php
Daan Meijer 77c3e34d5b
Some checks failed
linter / quality (push) Failing after 1m2s
tests / ci (8.3) (push) Failing after 47s
tests / ci (8.4) (push) Failing after 1m5s
tests / ci (8.5) (push) Failing after 1m5s
polishing
2026-06-22 15:21:27 +02:00

23 lines
468 B
PHP

<?php
namespace App\Http\Resources;
use Illuminate\Http\Request;
class DynamicResource extends BaseResource
{
/**
* Transform the resource into an array.
*
* @return array<string, mixed>
*/
public function toArray(Request $request): array
{
$result = parent::toArray($request);
if($this->ledgers){
$result['ledgers'] = LedgerResource::collection($this->ledgers);
}
return $result;
}
}