API Generator
For every CRUD, by default, QuickAdminPanel creates API Routes and Controllers for your CRUD menu item, so you can use it from your mobile app or front-end.
Whenever you create or edit a CRUD, there's a checkbox whether to generate the API functionality (see above).
If checked, there's a separate Controller created in app/Http/Controllers/Api/V1/Admin folder.
Also it's added to routes/api.php file, like this:
You can turn this function on/off for every CRUD separately.
How to Use Generated API
Default URL endpoints for all CRUDs are /api/v1/[crud_name]. We generate all API Resourceful Controller methods, so these URLs apply - see official Laravel docs:
GET /api/v1/users - get the list of users
POST /api/v1/users - create new user
GET /api/v1/users/1 - get the user with users.id = 1
PUT /api/v1/users/1 - update the user with users.id = 1
DELETE /api/v1/users/1 - delete the user with users.id = 1
Detailed visual example is in this blog article: QuickAdminPanel API Generator with Laravel Sanctum
How to Customize What API Returns
We also generate Eloquent API Resources with their default functionality. See, for example, app/Http/Resources/Admin/UserResource.php:
Authentication with Laravel Sanctum
Notice: our tool is generating API routes that are protected by middleware auth:sanctum that comes from Laravel Sanctum.
More information in this article: QuickAdminPanel API Generator with Laravel Sanctum
Uploading Files to API
Separate question from the customers was about uploading files to the API. For that, we have a separate article on our blog, which can be applied with or without QuickAdminPanel: Laravel API: How to Upload File from Vue.js
Generating API Documentation
QuickAdminPanel doesn't generate API docs by default, but here's another article on our blog about the tool that we recommend: Laravel API Documentation with OpenAPI/Swagger
Last updated