-1

I have such following Database Schema that I want to convert into Lumen API with migration, model and API. Since I am new to Lumen Laravel Framework so need experts help:

enter image description here

user10496245
  • 217
  • 3
  • 17

1 Answers1

0

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:

https://lumen.laravel.com/docs/8.x/database

Samuel Ferdary
  • 315
  • 2
  • 11