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 custom table names #1063

Closed
sasokovacic opened this issue Feb 18, 2021 · 7 comments
Closed

Support custom table names #1063

sasokovacic opened this issue Feb 18, 2021 · 7 comments

Comments

@sasokovacic
Copy link

Table names should be configurable so we can prefix them or just use custom names

@sasokovacic sasokovacic changed the title Support custom table name for subscribtions and users Support custom table name for subscriptions and users Feb 18, 2021
@sasokovacic sasokovacic changed the title Support custom table name for subscriptions and users Support custom table names Feb 18, 2021
@driesvints
Copy link
Member

No plans for this.

@sasokovacic
Copy link
Author

@driesvints what a "great" response... no explanation, just shutdown. thanks ;)

@driesvints
Copy link
Member

You can already overwrite the current migrations if you want: https://laravel.com/docs/8.x/billing#database-migrations

But changing the table names will conflict with the existing Eloquent models. That makes it hard to introduce custom table names. In general we don't want to support this because most use cases don't need custom table support and introducing this for a small minority just brings on an unnecessary maintenance burdon on us.

@sasokovacic
Copy link
Author

sasokovacic commented Feb 19, 2021

What about a configurable Subscription model? You already support a custom billable model. If I can set my own Subscription model in the configuration, then I'm able to make a new Subscription model that extends yours and set a new table name directly in it. Then I just overwrite your migrations and I'm done.
Correct me if I'm wrong but the only thing on your part, in this case, is you have to add a new line in the config file and use it in the subscriptions method in the Billable trait. But maybe I'm wrong.

@driesvints
Copy link
Member

Well actually, adding model swapping in the same fashion as Passport & Sanctum isn't a bad idea at all. I've just sent in a PR to do just that: #1067

@sasokovacic
Copy link
Author

Great. That was fast. Thanks. Have a great day :)

@driesvints
Copy link
Member

No worries. Sorry if I was a bit terse at first. Thanks for bringing this up 👍

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

No branches or pull requests

2 participants