Resource Registration
Defining a PHP Resource class does not make it available to an adapter. Registration is explicit: the host application maps a URL slug to the class in config/seviaflow.php. Core's ResourceRegistry reads this map and resolves the slug on each request.
1. Add the class to the resource map
For a class at app/SeviaFlow/Resources/CustomerResource.php with namespace App\SeviaFlow\Resources, add an entry like this inside the returned config array:
'resources' => [
'customers' => App\SeviaFlow\Resources\CustomerResource::class,
],
If the map already contains resources, add another key to it; do not replace the whole config file. The key is the public resource slug. Choose a simple lowercase slug and use it consistently in links, API clients, permissions and tests.
2. Understand what registration enables
The map makes a Resource resolvable. An installed adapter decides which routes exist, and the Resource decides whether a particular surface is enabled:
- Core alone: provides the registry and Resource primitives; it does not register UI or API routes.
- UI installed: registers the web pages for the slug. The default prefix is
/admin, socustomersappears at/admin/resources/customers. - API installed: registers REST routes. The Resource must also enable its API contract with
api()->enabled(); installing the package by itself does not opt every model into the API.
Default UI paths are /admin/resources/{resource}, /admin/resources/{resource}/create, /admin/resources/{resource}/{record} and /admin/resources/{resource}/{record}/edit. The default API paths use /api/admin/resources/{resource} and /api/admin/resources/{resource}/{record}. Route prefixes and middleware can be customized in the adapter configs.
3. Verify registration
After installing UI or API and editing config, clear the config cache and inspect registered routes:
php artisan config:clear
php artisan route:list --path=admin/resources
The route list shows {resource} rather than one route per slug: the registry resolves customers when the request reaches SeviaFlow. Then visit /admin/resources/customers (or your configured UI prefix) while signed in with a user allowed through the panel gate.
If the request returns a not-found response, check the slug spelling, class namespace, Composer autoloading, package installation and route/config cache. If the screen says the user is unauthorized, check the panel gate and Resource policy separately; see Authorization.
Discovery and generation
When DevTools is installed, it can inspect models and generate Resource files:
php artisan seviaflow:discover --with-schema
php artisan seviaflow:make-resource CustomerResource --model=Customer
Discovery helps identify candidate models; generation creates a starting point. Review generated fields and relationships against your application, add authorization and tenant scoping, and then register the class yourself. Explicit registration makes the exposure decision visible in code review.
Get Started