We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.

Ricardo Fernandes • 1 year ago

Hi there,

Perfect article. I'm building up a project with, at least, 100 table using laravel API REST.

for each table I have to create a model, migration and Controller?

I hear that just the id_relation_tables not require model and controller, thats it?

I'm a bit confused, because its a lot of tables 😐

I was trying to create one Model, one Controller and a migration for theme. Like just one of kind for all user interaction, one of kind for human_resources tables, one of kind for products....

Hope that you and help a little bit

Fajarwz • 1 year ago

not really sure what you mean by "theme and one of kind for all user interaction...", but if you currently dont have a table that handing theme, i think you can create it. for example you create a table for storing data regarding the theme itself on "themes" table (ex props: primary_color, font_size, etc.).

but if you need to store user's choice for theme, you can add an additional table like "user_themes" (ex props: user_id, theme_id, applied_at, etc.).

depends on the entities on your app

Fajarwz • 1 year ago

we dont need to always create a table/model for every feature. you should check the entity needed. if its a distinct entity, you can create a new one, otherwise, maybe you can utilize an existing table.

try to learn database design including ER model, normalization, relationships, etc.

Ricardo Fernandes • 1 year ago

Will learn more about the database design

thank you

Ricardo Fernandes • 1 year ago

Thanks.

I read something about that and i will create a migration with all "create_tables" for each "area".

meaning: create a migration for handle all user tables ("tb_users, tb_user_type, tb_user_premissions....)

next create a migration for all "products tables" (tb_warehouses, tb_products.....)

create a model User and a model Products, with multiple class Models, and a Controller for each too

its correct?

my doubt started with the codes "pho artisan make:Model Products -mrc

or -a for all

look like i will need to create all ou this for each tables

Kagiso Mahlobogoane • 1 year ago

This is perfect. Can you perhaps create another tutorial for if you want to authenticate in a microservices architecture?

Fajarwz • 1 year ago

glad you liked it. if you mean server-server authentication, actually jwt can be implemented for both client-server authentication and server-server authentication