gnikyt / laravel-shopify

A full-featured Laravel package for aiding in Shopify App development
MIT License
1.24k stars 374 forks source link

How to use CRON to update products #1146

Closed srimanutd closed 2 years ago

srimanutd commented 2 years ago

I Just loaded the shop from the DB. Then initialize the shop API as given on #609

$shop = User::where('name', $record->shopname)->first(); $result=$shop->api()->rest('PUT','/admin/api/2022-04/products/'.$record->shopifyproductid.'.json', ['product'=>['status'=>$record->unprod_status]]);

But I get the following error: Column not found: 1054 Unknown column '6' in 'field list' (SQL: select 6 from users where shopify_namespace is null and users.deleted_at is null limit 1) {"exception":"[object] (Illuminate\Database\QueryException(code: 42S22): SQLSTATE[42S22]: Column not found: 1054 Unknown column '6' in 'field list' (SQL: select 6 from users where shopify_namespace is null and users.deleted_at is null limit 1)

Do I need to add any other thing for accessing the Shop API using Cron

Kyon147 commented 2 years ago

Your eloquent query looks like it is missing the operator.

Try User::where('name', '=', $record->shopname)->first();