'user', '_resource' => 'user', ]; foreach ($this->getAttributes() as $attribute => $value) { switch ($attribute) { case 'id': case 'name': case 'mobile': case 'email': case 'created_at': case 'updated_at': $resource[$attribute] = $value; break; } } $resource['includes']['fingerprints'] = $this->whenLoaded('fingerprints', function () { return FingerprintResource::collection($this->fingerprints); }); return $resource; } }