lmsqueezy / laravel

A package to easily integrate your Laravel application with Lemon Squeezy.
https://lemonsqueezy.com
MIT License
468 stars 47 forks source link

Add configurable table names #71

Closed benbjurstrom closed 4 months ago

benbjurstrom commented 4 months ago

This pull request adds configurable table names to the config file. Created because I needed to move the tables to a different schema and wasn't sure how to override the package model's getTable methods.

For each config usage I set a default of the original table name, therefore this change should be backwards compatible even if the end user already published an older version of the config.

driesvints commented 4 months ago

Heya, thanks for your PR. However, this is already possible. You can publish the migrations:

https://github.com/lmsqueezy/laravel/blob/main/src/LemonSqueezyServiceProvider.php#L62-L64

Then override the models by extending them with your own and adjusting the table name:

https://github.com/lmsqueezy/laravel/blob/main/src/LemonSqueezy.php#L111

benbjurstrom commented 4 months ago

Perfect thanks! Looks like you'd use the useCustomerModel/useOrderModel in your app service provider the same way you'd use ignoreMigrations.