melihovv / laravel-shopping-cart

Laravel shopping cart package
MIT License
73 stars 29 forks source link

Update migration to use table config value. #13

Open JayteeNZ opened 4 years ago

JayteeNZ commented 4 years ago

Not sure how this was missed, but the table key in the config is pointless, as this package just generates a shopping_cart table regardless, and only uses the config value when dealing with the database repository.

Whether that is intended or not, probably isn't a good idea, as a minimum of two tables would need to be generated if a custom config table was provided, in order for this to work.

How to resolve? Should just be good to update the migration file to include the config value for the up and down methods.

On the off-side, I'd recommend adding an eloquent model also. This is a Laravel package after all, and most users deal with eloquent rather than the query builder. Would make things a lot easier.

I've been struggling to find a decent cart package, and this is the closest to what I've required believe it or not, so I'd rather put my support into this package, than keep with rolling my own solution. I'm quite shocked that most developers in this Laravel community have not managed to develop a half decent cart package, so props to you for developing this, as it's probably the best one out, and it's super simple behind the scenes.

melihovv commented 4 years ago

Hi, @JayteeNZ Yeah, you are right, I have missed it Can you send me pr? I think config('shopping-cart.database.table', 'shopping_cart') in migration will solve the problem