简体   繁体   English

Laravel Shopify Oiset:如何正确使用 Oiset 功能?

[英]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.

相关问题 Laravel + Shopify Osiset productVariantUpdate GraphQL - Laravel + Shopify Osiset productVariantUpdate GraphQL 使用 Laravel + Shopify Osiset 发出 Ajax 请求时如何设置商店? - How to set shop when making Ajax request with Laravel + Shopify Osiset? 尝试在商店中安装应用程序时,此地址没有页面 Shopify Laravel App - Getting There’s no page at this address when trying to install app on the store Shopify Laravel App Osiset Laravel 5:jenssegers / laravel-date没有显示正确的翻译。 如何正确使用Laravel Date? - Laravel 5: jenssegers/laravel-date doesn't show correct translation. How do I use Laravel Date correctly? 如何使用 if 路由条件在 2 个单独的视图函数中使用相同的渲染? (Laravel/Livewire) - How do I use the same render in 2 separate view functions using the if route is condition? (Laravel/Livewire) 我如何在这里正确使用forloop? - How do I use a forloop correctly here? 如何在 php 中正确使用 GET? - How do i use GET correctly in php? 如何正确使用Scandir()? - How do I correctly use the Scandir()? 如何自定义和使用Phirehose功能? - How do I customize and use Phirehose functions? 如何在JavaScript中使用php函数? - How do I use php functions in javascript?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM