Server Interactions and AJAX
1. Server Interactions and AJAX
Never disable authentication or authorization middleware to make an endpoint easier to test. The former page recommended an unsafe development shortcut and has been replaced.
1.1. Preferred approaches
Livewire for new reactive UI and server actions
Base MVC DataTables endpoints for existing index pages
Module API routes for reusable JSON endpoints
1.2. Requirements
Use named routes in the module’s route files
Keep authentication and ability middleware enabled
Validate all input server-side
Return a documented JSON response or API Resource
Add feature tests for authorized and unauthorized callers
1.3. Existing DataTables flow
BaseRoute::resource() registers a protected DataTables endpoint handled by BaseController::index_datatables_ajax. Reuse it for standard Base MVC listings rather than adding a parallel route.