onelearningcommunity/laravel-model-explorer
API routes and Vue Router paths must embed a model identifier in the URL, e.g. /models/{model}. The natural identifier is the model's fully-qualified class name (App\Models\Post), but backslashes are not legal in URL path segments without percent-encoding. Percent-encoding backslashes produces App%5CModels%5CPost, which is technically valid but creates double-encoding risks when passed through Laravel's router, and is awkward to construct consistently in both PHP and JavaScript.
Alternatives considered:
\ with a safe delimiter (e.g., . or -) — fragile if class names contain the chosen delimiter; requires a decode convention that is easy to get wrong with namespaced classes.basename of the class (e.g., Post). Collides when two models in different namespaces share a short name.Model class names are base64url-encoded wherever they appear in API paths or Vue Router routes. The encoding is standard base64 with padding stripped and URL-unsafe characters substituted:
JavaScript (encoding):
btoa(className).replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, '')
PHP (decoding):
base64_decode(strtr($slug, '-_', '+/'))
This pair is applied consistently in all three API controllers (ModelsController, RecordsController, GraphController) and in Vue Router navigation helpers.
Positive:
Negative:
/models/QXBwXE1vZGVsc1xQb3N0 is not human-readable. Deep-links cannot be hand-constructed without knowing the encoding.How can I help you explore Laravel packages today?