abeta-io / laravel
Abeta 扩展程序,适用于 Laravel
dev-main
2023-12-10 12:22 UTC
Requires
- php: ~7.0|~8.0
Requires (Dev)
- phpunit/phpunit: ^8.1
This package is auto-updated.
Last update: 2024-09-10 13:54:14 UTC
README
Abeta 官方 Laravel 插件。通过 Abeta,快速轻松地提供 OCI 和 cXML PunchOut。与 Coupa、Oracle 和 Sap Ariba 等采购系统/ERP 连接。借助 B2B 连接,增加现有客户的销售额或吸引新客户。
安装
通过 composer 安装
composer require abeta-io/laravel
快速开始
使用类
use AbetaIO\Laravel\AbetaPunchout; // Don't forget to make the necessary changes to your VerifyCsrfToken file! //Create an endpoint for the setupRequest Route::post('/abeta-setup-request', function (Request $request) { return AbetaPunchout::setupRequest($request); }); //Create an endpoint for a login Route::post('/abeta-login', function (Request $request) { $loggedInUser = AbetaPunchout::login($request); // redirect logged in user to shop }); //Create an endpoint for a login Route::post('/abeta-cart', function (Request $request) { //Return Cart and Product Model or Array to Abeta $returned = AbetaPunchout::returnCart($cart, $products); //Return Customer to Abeta return AbetaPunchout::returnCustomer(); });
使用全局辅助函数检查用户是否为 PunchOut 用户
if( is_abeta_punchout_user() ) { //show button to abeta return cart } else { //show regulal checkout button }
使用除 User 模型以外的其他模型
想要使用 Laravel 默认的 User 模型以外的其他模型?在 config/ 文件夹中创建一个名为 abeta.php 的配置文件。之后,用您自己的值替换所需的值。
<?php /* * Configuration of the Abeta Punchout Package, used to offer OCI and cXML via the Abeta Middleware. */ return [ /* * Customer model, used to select customer from. */ 'customerModel' => '\App\Models\User', /* * Auth provider */ 'auth' => '\Illuminate\Support\Facades\Auth', /* * String, representing database column of username */ 'username' => 'email', /* * String, representing database column of password */ 'password' => 'password', ];