onelearningcommunity/laravel-model-explorer
Eloquent accessor attributes ($appends, old-style getFooAttribute(), and new-style foo(): Attribute) are computed values. Their cost and safety vary widely:
Loading all accessors eagerly on RecordsController::show() would make the endpoint slow for models with expensive accessors, and brittle for models where any accessor can throw. A single throwing accessor would make the entire record inaccessible.
RecordsController::show() returns only the model's raw stored attribute values via Model::getAttributes(). No accessor logic is evaluated.
Accessor and virtual attributes are resolved lazily via two additional endpoints:
GET /api/models/{model}/record/{id}/attributes — evaluates all accessor attributes for the record. Each accessor is evaluated independently inside a try/catch; errors are returned as { error: "..." } rather than aborting the response.GET /api/models/{model}/record/{id}/attributes/{name} — evaluates a single named accessor.ModelRecord.vue calls the bulk endpoint lazily when the user expands the "Accessors" panel. Individual accessors can also be re-fetched independently.
All accessor resolution endpoints are wrapped in withinSafeRead() (see ADR-006).
Positive:
Negative:
$appends, with no corresponding DB column) are not visible in the raw getAttributes() response — they are only surfaced via the accessor endpoints. The UI must communicate this clearly.How can I help you explore Laravel packages today?