Closed niveshsaharan closed 4 years ago
Just create a new migration that adds fields to the shop table. Then just run php artisan migrate
Note: for v11+ you would use the Users table.
Just create a new migration that's adds fields to the shop table. Then just run
php artisan migrate
Yes, but how would I fetch and save values for those columns, can you suggest a clean approach?
You would update and fetch the values like you would any other value in another table. Using Eloquent or the DB class.
I'm sorry that I wasn't very clear in my original question. Let me try to explain it a bit more:
I need to add more fields to shops table so I already have all the migration etc ready for that. Now comes the part when I need to store the data to those fields for each shop. So I need to dispatch a job after Authentication that I can easily do in config file, The problem is we need to get the data from Shop's API '/admin/shop.json' if I am correct so for that I need to use $shop->apiHelper() but there is no public method to call the custom api endpoint. So either I have to make my own method and use BasicShopifyAPI class or add a method in the package itself to allow that.
I hope that makes a little more sense.
The API package comes loaded with this one. So when you have your shop model you just use it.
$request = $shop->api()->rest('GET', '/admin/shop.json');
Then you just store whatever info you want. This example above is in the wiki - have you read it as it should give you enough of the basics? https://github.com/osiset/laravel-shopify/wiki/Usage
Oh thank you. I missed this particular wiki page.
No problem, it should help with the basics :)
I need to save additional columns for a shop like their currency or their Shopify ID. I tried to dig into the code and couldn't find anything like that.
Can somebody please guide me on that?