Routes & API
Tapix registers its own routes through TapixServiceProvider when route registration is enabled. This page covers route configuration, disabling routes, and available endpoints.
Route Configuration
The route settings are defined in the Tapix configuration file:
'routes' => [
'enabled' => true,
'prefix' => 'imports',
'domain' => null,
'middleware' => ['web', 'auth'],
],
enabled
Controls whether Tapix registers its built-in routes. Set to false to disable route registration entirely.
prefix
The URL prefix for all Tapix routes. The default value imports produces URLs like /imports/.... Change this to customize the URL path.
domain
Set a domain to restrict Tapix routes to a specific subdomain. When null, routes are registered on the default application domain.
middleware
An array of middleware applied to all Tapix routes. The default includes web and auth. Add or remove middleware as needed for your application.
Disabling Routes
There are three ways to disable the built-in Tapix routes:
1. Configuration
Set enabled to false in the routes configuration:
'routes' => [
'enabled' => false,
],
2. Programmatic
Call Tapix::disableRoutes() in a service provider's boot method:
use Tapix\Core\Tapix;
public function boot(): void
{
Tapix::disableRoutes();
}
3. Automatic (Filament)
When TapixPlugin is registered in a Filament panel, built-in routes are automatically disabled. Filament manages its own routing for the plugin pages, so the standalone routes are not needed.
Available Endpoints
Failed Rows Download
Tapix provides an endpoint for downloading failed rows after an import completes. This allows users to retrieve a file containing only the rows that could not be imported, along with error details, so they can correct and re-import them.
Custom Middleware
Modify the middleware array in the configuration to apply additional middleware to Tapix routes:
'routes' => [
'middleware' => ['web', 'auth', 'verified', 'role:admin'],
],
Custom Domain
Set the domain option to serve Tapix routes from a specific subdomain:
'routes' => [
'domain' => 'admin.example.com',
],
Custom Prefix
Change the prefix to customize the base URL path for all Tapix routes:
'routes' => [
'prefix' => 'admin/csv-imports',
],
This would produce URLs like /admin/csv-imports/....