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

Support Non-Default Namespace for Model Type Export #29

Merged

Conversation

NaoyaMiyagawa
Copy link
Collaborator

@NaoyaMiyagawa NaoyaMiyagawa commented May 19, 2024

Issues

Changes

This PR changes the way to specify a model name in php artisan model:show command. This change is inspired from this comment below:

Meaning, conventionally model:show command was used like this:

php artisan model:show User ...
php artisan model:show Common/History ...

And moving forward, model:show command will be used like this:

php artisan model:show App\\Models\\User ...
php artisan model:show App\\Models\\Common\\History ...

// if modular monolith
php artisan model:show Modules\\Post\\Comment ...

Output

Result of debug.sh

(no change)

Sample result of output in modular monolith structure:

Comment on lines +44 to +45
.split("/")
.at(-1)!; // get only model name without directory
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is to extract History from Common/History, otherwise model:show command becomes like model:show App\\Models\\Common\\Common/History

const routeListCommand = `php artisan route:list ${options.vendorRoutes ? "" : "--except-vendor"
} --json > ${tmpDir}/route.json`;
const vendorOption = options.vendorRoutes ? "" : "--except-vendor";
const routeListCommand = `php artisan route:list ${vendorOption} --json > ${tmpDir}/route.json`;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Just a refactoring

@NaoyaMiyagawa
Copy link
Collaborator Author

Hi @7nohe, I made an attempt to resolve the issue I raised. Let me know if you have any issues or concerns about this change!

Copy link
Owner

@7nohe 7nohe left a comment

Choose a reason for hiding this comment

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

Looks great! Thanks.

@7nohe 7nohe merged commit 6a5a4f3 into 7nohe:main May 19, 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.

[Feature Request] Support Non-Default Namespace for Model Type Export
2 participants