Search code examples
laravel-backpacklaravel-api

Exposing the API end-points for CRUD Operations in Laravel Backpack


How can I expose api-end points for the CRUD controllers used for backpack so that I can reuse the operations in the controllers without having to code new ones, while adding necessary api features like JSON, authentication modes


Solution

  • Looks like Backpack routes work like API end-points for XHR requests, so adding a header HTTP_X-Requested-With with a value XMLHttpRequest causes backpack to return with JSON