Lumen is the light weight stripped version of Laravel, that is why I rever to the Laravel documentation in this answer.
First step is to write migration files, see:
https://laravel.com/docs/8.x/migrations
after creating the migrations files you can migrate the schemas with:
php artisan migrate
The next step is to create models for the tables, see:
https://laravel.com/docs/8.x/eloquent#generating-model-classes
This is necessary to query the data from the database with Eloquent (ORM in Laravel).
The two steps above can be combined with the command:
php artisan make:model ModalName --migration
The next step is to create a controller, this class will be used as a layer between your view/api and the data models, see:
https://laravel.com/docs/8.x/controllers
Last step: After creating your logic, you can register the controller in your api routes file, see:
https://laravel.com/docs/8.x/routing
The routes file you are looking for is called: api.php
If the ORM isn't what you are looking for then you can also use the query builder:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.