[英]Laravel Shopify Osiset: How do I use Osiset functions correctly?
I've been dealing with the Laravel/Osiset-Shopify
framework for some time and even after a long research there are things that I don't understand yet.我一直在处理
Laravel/Osiset-Shopify
框架一段时间,即使经过长时间的研究,有些东西我还不明白。
For example, if I want to fetch my webhooks, it is relatively cumbersome例如,如果我想获取我的 webhook,它就比较麻烦
Auth::user()->api()->rest('GET', '/admin/api/2021-04/webhooks.json')['body']
There is a function getWebhooks()
under \osiset\laravel-shopify\src\ShopifyApp\Services\ApiHelper.php
which I would much rather use.在
\osiset\laravel-shopify\src\ShopifyApp\Services\ApiHelper.php
下有一个 function getWebhooks()
我更愿意使用它。
I came across this documentation from Osiset, for which I don't know how to use it.我从 Oiset 看到了这个文档,我不知道如何使用它。
I tried to load the service use Osiset\ShopifyApp\Services\ApiHelper;
我尝试
use Osiset\ShopifyApp\Services\ApiHelper;
and get the output data dd(ApiHelper::getWebhooks([]));
并获取 output 数据
dd(ApiHelper::getWebhooks([]));
. . However, I get the error message
Non-static method Osiset\ShopifyApp\Services\ApiHelper::getWebhooks() cannot be called statically
.但是,我收到错误消息
Non-static method Osiset\ShopifyApp\Services\ApiHelper::getWebhooks() cannot be called statically
。
Also还
$foo = new ApiHelper;
dd( $foo->getWebhooks() );
did not lead to any result: Call to a member function rest() on null
.没有导致任何结果:
Call to a member function rest() on null
。
Can someone show me how to access Osiset's internal functions and use the documentation properly?有人可以告诉我如何访问 Oiset 的内部功能并正确使用文档吗?
You can use this documentation您可以使用此文档
and for the webhooks.json, You can use this to get the results $userId will be the user's primary key.对于 webhooks.json,您可以使用它来获取结果 $userId 将是用户的主键。
$shop = User::find($userId);
$method = 'GET';
$url = '/admin/api/2021-04/webhooks.json';
return $shop->api()->rest($method, $url, []);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.