Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Str::plural for Dynamic Table Naming in Models and Migrations #17

Merged
merged 1 commit into from
Dec 14, 2024

Conversation

sarahelsagheir
Copy link
Contributor

When creating a module (e.g., Company), the migration table name and the protected $table property in the model are incorrectly set to companys instead of companies. This issue occurs because the table name generation logic appends an 's' to the model name, which fails for irregular pluralization.

To fix this, I replaced the static 's' logic with Laravel's Str::plural helper. This change dynamically generates the correct plural form of the table name, ensuring accurate and consistent pluralization for both regular and irregular nouns.

Copy link
Collaborator

@daniel-cintra daniel-cintra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @sarahelsagheir !

This makes perfect sense! I’m really grateful for the time and effort you put into this Pull Request.

I’ll make sure to also propagate the change from the ModuleController/Index method to the related Module/Index.vue page.

Thank you so much!

@daniel-cintra daniel-cintra merged commit a733cd4 into ModularThink:main Dec 14, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants