Primo Committ
This commit is contained in:
3
vendor/codexshaper/laravel-woocommerce/.gitattributes
vendored
Normal file
3
vendor/codexshaper/laravel-woocommerce/.gitattributes
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
*.php linguist-language=PHP
|
||||
*.js linguist-language=PHP
|
||||
*.vue linguist-language=PHP
|
||||
11
vendor/codexshaper/laravel-woocommerce/.gitignore
vendored
Normal file
11
vendor/codexshaper/laravel-woocommerce/.gitignore
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
/node_modules
|
||||
/public/hot
|
||||
/public/storage
|
||||
/storage/*.key
|
||||
/vendor
|
||||
.env
|
||||
.phpunit.result.cache
|
||||
Homestead.json
|
||||
Homestead.yaml
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
22
vendor/codexshaper/laravel-woocommerce/.scrutinizer.yml
vendored
Normal file
22
vendor/codexshaper/laravel-woocommerce/.scrutinizer.yml
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
filter:
|
||||
excluded_paths: [tests/*]
|
||||
checks:
|
||||
php:
|
||||
code_rating: true
|
||||
remove_extra_empty_lines: true
|
||||
remove_php_closing_tag: true
|
||||
remove_trailing_whitespace: true
|
||||
fix_use_statements:
|
||||
remove_unused: true
|
||||
preserve_multiple: false
|
||||
preserve_blanklines: true
|
||||
order_alphabetically: true
|
||||
fix_php_opening_tag: true
|
||||
fix_linefeed: true
|
||||
fix_line_ending: true
|
||||
fix_identation_4spaces: true
|
||||
fix_doc_comments: true
|
||||
tools:
|
||||
external_code_coverage:
|
||||
timeout: 600
|
||||
runs: 2
|
||||
20
vendor/codexshaper/laravel-woocommerce/.travis.yml
vendored
Normal file
20
vendor/codexshaper/laravel-woocommerce/.travis.yml
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
language: php
|
||||
|
||||
php:
|
||||
- '7.2'
|
||||
- '7.3'
|
||||
|
||||
before_script:
|
||||
- travis_retry composer self-update
|
||||
- travis_retry composer update --prefer-lowest --prefer-source --no-interaction
|
||||
|
||||
script:
|
||||
- phpunit --coverage-text --coverage-clover=coverage.clover
|
||||
|
||||
after_script:
|
||||
- wget https://scrutinizer-ci.com/ocular.phar
|
||||
- php ocular.phar code-coverage:upload --format=php-clover coverage.clover
|
||||
|
||||
notifications:
|
||||
on_success: never
|
||||
on_failure: always
|
||||
21
vendor/codexshaper/laravel-woocommerce/LICENSE.md
vendored
Normal file
21
vendor/codexshaper/laravel-woocommerce/LICENSE.md
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
# MIT License
|
||||
|
||||
Copyright (c) 2019 Md. Abu Ahsan Basir
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
92
vendor/codexshaper/laravel-woocommerce/README.md
vendored
Normal file
92
vendor/codexshaper/laravel-woocommerce/README.md
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
[](http://badges.mit-license.org)
|
||||
[](https://travis-ci.org/Codexshaper/laravel-woocommerce)
|
||||
[](https://github.styleci.io/repos/180436811)
|
||||
[](https://scrutinizer-ci.com/g/Codexshaper/laravel-woocommerce)
|
||||
[](https://packagist.org/packages/Codexshaper/laravel-woocommerce)
|
||||
[](https://packagist.org/packages/Codexshaper/laravel-woocommerce)
|
||||
|
||||
# Description
|
||||
WooCommerce Rest API for Laravel. You can Get, Create, Update and Delete your woocommerce product using this package easily.
|
||||
|
||||
[Documentation](https://codexshaper.github.io/docs/laravel-woocommerce/)
|
||||
|
||||
## Authors
|
||||
|
||||
* **Md Abu Ahsan Basir** - [github](https://github.com/maab16)
|
||||
|
||||
## License
|
||||
|
||||
- **[MIT license](http://opensource.org/licenses/mit-license.php)**
|
||||
- Copyright 2020 © <a href="https://github.com/Codexshaper/laravel-woocommerce/blob/master/LICENSE" target="_blank">CodexShaper</a>.
|
||||
|
||||
# Eloquent Style for Product, Customer and Order
|
||||
|
||||
```
|
||||
// Where passing multiple parameters
|
||||
$products = Product::where('title','hello')->get();
|
||||
OR
|
||||
// You can call field with where clause
|
||||
$products = Product::whereTitle('hello')->get();
|
||||
// Fields name are more than one words or seperate by underscore (_). For example field name is `min_price`
|
||||
$products = Product::whereMinPrice(5)->get();
|
||||
|
||||
// Where passing an array
|
||||
$orders = Order::where(['status' => 'processing']);
|
||||
$orders = Order::where(['status' => 'processing', 'orderby' => 'id', 'order' => 'asc'])->get();
|
||||
|
||||
// Set Options
|
||||
$orders = Order::options(['status' => 'processing', 'orderby' => 'id', 'order' => 'asc'])->get();
|
||||
|
||||
// You can set options by passing an array when call `all` method
|
||||
$orders = Order::all(['status' => 'processing', 'orderby' => 'id', 'order' => 'asc']);
|
||||
```
|
||||
#Product Options: https://woocommerce.github.io/woocommerce-rest-api-docs/#products
|
||||
|
||||
#Customer Options: https://woocommerce.github.io/woocommerce-rest-api-docs/#customers
|
||||
|
||||
#Order Options: https://woocommerce.github.io/woocommerce-rest-api-docs/#orders
|
||||
|
||||
# You can also use ```WooCommerce``` Facade
|
||||
|
||||
```
|
||||
use Codexshaper\WooCommerce\Facades\WooCommerce;
|
||||
|
||||
public function products()
|
||||
{
|
||||
return WooCommerce::all('products');
|
||||
}
|
||||
|
||||
public function product( Request $request )
|
||||
{
|
||||
$product = WooCommerce::find('products/'.$request->id);
|
||||
}
|
||||
|
||||
public function orders()
|
||||
{
|
||||
return WooCommerce::all('orders');
|
||||
}
|
||||
|
||||
public function order( Request $request )
|
||||
{
|
||||
$order = WooCommerce::all('orders/'.$request->id);
|
||||
}
|
||||
|
||||
public function customers()
|
||||
{
|
||||
return WooCommerce::all('customers');
|
||||
}
|
||||
|
||||
public function customer( Request $request )
|
||||
{
|
||||
$customer = WooCommerce::all('customers/'.$request->id);
|
||||
}
|
||||
```
|
||||
|
||||
# Use Facade Alias
|
||||
|
||||
```
|
||||
use WooCommerce // Same as use Codexshaper\WooCommerce\Facades\WooCommerce;
|
||||
use Customer // Same as use Codexshaper\WooCommerce\Models\Customer;
|
||||
use Order // Same as use Codexshaper\WooCommerce\Models\Order;
|
||||
use Product // Same as Codexshaper\WooCommerce\Models\Product;
|
||||
```
|
||||
67
vendor/codexshaper/laravel-woocommerce/composer.json
vendored
Normal file
67
vendor/codexshaper/laravel-woocommerce/composer.json
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
{
|
||||
"name": "codexshaper/laravel-woocommerce",
|
||||
"description": "WooCommerce Rest API for Laravel",
|
||||
"keywords": [
|
||||
"woocommerce",
|
||||
"laravel",
|
||||
"laravel-woocommerce",
|
||||
"woocommerce-api",
|
||||
"woocommerce-rest-api",
|
||||
"laravel-woocommerce-api",
|
||||
"laravel-woocommerce-rest-api"
|
||||
],
|
||||
"type": "library",
|
||||
"require": {
|
||||
"automattic/woocommerce": "^3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^7.0|^8.0|^9.3",
|
||||
"illuminate/support": "~5.5.40|~5.6.0|~5.7.0|~5.8.0|^6.0|^7.0|^8.0"
|
||||
},
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Md Abu Ahsan Basir",
|
||||
"email": "maab.career@gmail.com"
|
||||
}
|
||||
],
|
||||
"minimum-stability": "dev",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Codexshaper\\WooCommerce\\": "src/"
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Codexshaper\\WooCommerce\\WooCommerceServiceProvider"
|
||||
],
|
||||
"aliases": {
|
||||
"Attribute": "Codexshaper\\WooCommerce\\Models\\Attribute",
|
||||
"Category": "Codexshaper\\WooCommerce\\Models\\Category",
|
||||
"Coupon": "Codexshaper\\WooCommerce\\Models\\Coupon",
|
||||
"Customer": "Codexshaper\\WooCommerce\\Models\\Customer",
|
||||
"Note": "Codexshaper\\WooCommerce\\Models\\Note",
|
||||
"Order": "Codexshaper\\WooCommerce\\Models\\Order",
|
||||
"PaymentGateway": "Codexshaper\\WooCommerce\\Facades\\PaymentGateway",
|
||||
"Product": "Codexshaper\\WooCommerce\\Models\\Product",
|
||||
"Refund": "Codexshaper\\WooCommerce\\Models\\Refund",
|
||||
"Report": "Codexshaper\\WooCommerce\\Models\\Report",
|
||||
"Review": "Codexshaper\\WooCommerce\\Models\\Review",
|
||||
"Setting": "Codexshaper\\WooCommerce\\Models\\Setting",
|
||||
"ShippingMethod": "Codexshaper\\WooCommerce\\Models\\ShippingMethod",
|
||||
"ShippingZone": "Codexshaper\\WooCommerce\\Models\\ShippingZone",
|
||||
"ShippingZoneMethod": "Codexshaper\\WooCommerce\\Models\\ShippingZoneMethod",
|
||||
"System": "Codexshaper\\WooCommerce\\Models\\System",
|
||||
"Tag": "Codexshaper\\WooCommerce\\Models\\Tag",
|
||||
"Tax": "Codexshaper\\WooCommerce\\Models\\Tax",
|
||||
"TaxClass": "Codexshaper\\WooCommerce\\Models\\TaxClass",
|
||||
"Term": "Codexshaper\\WooCommerce\\Models\\Term",
|
||||
"Variation": "Codexshaper\\WooCommerce\\Models\\Variation",
|
||||
"Webhook": "Codexshaper\\WooCommerce\\Facades\\Webhook",
|
||||
"WooCommerce": "Codexshaper\\WooCommerce\\Facades\\WooCommerce",
|
||||
"Query": "Codexshaper\\WooCommerce\\Facades\\Query"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
66
vendor/codexshaper/laravel-woocommerce/composer.lock
generated
vendored
Normal file
66
vendor/codexshaper/laravel-woocommerce/composer.lock
generated
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
{
|
||||
"_readme": [
|
||||
"This file locks the dependencies of your project to a known state",
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "5673c61b72915f0a71a70d93634cb73d",
|
||||
"packages": [
|
||||
{
|
||||
"name": "automattic/woocommerce",
|
||||
"version": "3.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/woocommerce/wc-api-php.git",
|
||||
"reference": "a71aa95cc3de3f1d68c6303525d03c0557a96137"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/woocommerce/wc-api-php/zipball/a71aa95cc3de3f1d68c6303525d03c0557a96137",
|
||||
"reference": "a71aa95cc3de3f1d68c6303525d03c0557a96137",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-curl": "*",
|
||||
"ext-json": "*",
|
||||
"php": ">= 5.4.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "*",
|
||||
"squizlabs/php_codesniffer": "3.*"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Automattic\\WooCommerce\\": [
|
||||
"src/WooCommerce"
|
||||
]
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Claudio Sanches",
|
||||
"email": "claudio.sanches@automattic.com"
|
||||
}
|
||||
],
|
||||
"description": "A PHP wrapper for the WooCommerce REST API",
|
||||
"keywords": [
|
||||
"api",
|
||||
"woocommerce"
|
||||
],
|
||||
"time": "2019-01-16T20:28:40+00:00"
|
||||
}
|
||||
],
|
||||
"packages-dev": [],
|
||||
"aliases": [],
|
||||
"minimum-stability": "stable",
|
||||
"stability-flags": [],
|
||||
"prefer-stable": false,
|
||||
"prefer-lowest": false,
|
||||
"platform": [],
|
||||
"platform-dev": []
|
||||
}
|
||||
23
vendor/codexshaper/laravel-woocommerce/phpunit.xml
vendored
Normal file
23
vendor/codexshaper/laravel-woocommerce/phpunit.xml
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
|
||||
backupGlobals="false"
|
||||
backupStaticAttributes="false"
|
||||
bootstrap="vendor/autoload.php"
|
||||
colors="true"
|
||||
convertErrorsToExceptions="true"
|
||||
convertNoticesToExceptions="true"
|
||||
convertWarningsToExceptions="true"
|
||||
processIsolation="false"
|
||||
stopOnFailure="false">
|
||||
<testsuites>
|
||||
<testsuite name="Unit">
|
||||
<directory suffix="Test.php">./tests</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<filter>
|
||||
<whitelist processUncoveredFilesFromWhitelist="true">
|
||||
<directory suffix=".php">./src</directory>
|
||||
</whitelist>
|
||||
</filter>
|
||||
</phpunit>
|
||||
18
vendor/codexshaper/laravel-woocommerce/src/Facades/Attribute.php
vendored
Normal file
18
vendor/codexshaper/laravel-woocommerce/src/Facades/Attribute.php
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Codexshaper\WooCommerce\Facades;
|
||||
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
class Attribute extends Facade
|
||||
{
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'Codexshaper\WooCommerce\Models\Attribute';
|
||||
}
|
||||
}
|
||||
18
vendor/codexshaper/laravel-woocommerce/src/Facades/Category.php
vendored
Normal file
18
vendor/codexshaper/laravel-woocommerce/src/Facades/Category.php
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Codexshaper\WooCommerce\Facades;
|
||||
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
class Category extends Facade
|
||||
{
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'Codexshaper\WooCommerce\Models\Category';
|
||||
}
|
||||
}
|
||||
18
vendor/codexshaper/laravel-woocommerce/src/Facades/Coupon.php
vendored
Normal file
18
vendor/codexshaper/laravel-woocommerce/src/Facades/Coupon.php
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Codexshaper\WooCommerce\Facades;
|
||||
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
class Coupon extends Facade
|
||||
{
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'Codexshaper\WooCommerce\Models\Coupon';
|
||||
}
|
||||
}
|
||||
18
vendor/codexshaper/laravel-woocommerce/src/Facades/Customer.php
vendored
Normal file
18
vendor/codexshaper/laravel-woocommerce/src/Facades/Customer.php
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Codexshaper\WooCommerce\Facades;
|
||||
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
class Customer extends Facade
|
||||
{
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'Codexshaper\WooCommerce\Models\Customer';
|
||||
}
|
||||
}
|
||||
18
vendor/codexshaper/laravel-woocommerce/src/Facades/Note.php
vendored
Normal file
18
vendor/codexshaper/laravel-woocommerce/src/Facades/Note.php
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Codexshaper\WooCommerce\Facades;
|
||||
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
class Note extends Facade
|
||||
{
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'Codexshaper\WooCommerce\Models\Note';
|
||||
}
|
||||
}
|
||||
18
vendor/codexshaper/laravel-woocommerce/src/Facades/Order.php
vendored
Normal file
18
vendor/codexshaper/laravel-woocommerce/src/Facades/Order.php
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Codexshaper\WooCommerce\Facades;
|
||||
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
class Order extends Facade
|
||||
{
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'Codexshaper\WooCommerce\Models\Order';
|
||||
}
|
||||
}
|
||||
18
vendor/codexshaper/laravel-woocommerce/src/Facades/PaymentGateway.php
vendored
Normal file
18
vendor/codexshaper/laravel-woocommerce/src/Facades/PaymentGateway.php
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Codexshaper\WooCommerce\Facades;
|
||||
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
class PaymentGateway extends Facade
|
||||
{
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'Codexshaper\WooCommerce\Models\PaymentGateway';
|
||||
}
|
||||
}
|
||||
18
vendor/codexshaper/laravel-woocommerce/src/Facades/Product.php
vendored
Normal file
18
vendor/codexshaper/laravel-woocommerce/src/Facades/Product.php
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Codexshaper\WooCommerce\Facades;
|
||||
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
class Product extends Facade
|
||||
{
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'Codexshaper\WooCommerce\Models\Product';
|
||||
}
|
||||
}
|
||||
18
vendor/codexshaper/laravel-woocommerce/src/Facades/Query.php
vendored
Normal file
18
vendor/codexshaper/laravel-woocommerce/src/Facades/Query.php
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Codexshaper\WooCommerce\Facades;
|
||||
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
class Query extends Facade
|
||||
{
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'Codexshaper\WooCommerce\Query';
|
||||
}
|
||||
}
|
||||
18
vendor/codexshaper/laravel-woocommerce/src/Facades/Refund.php
vendored
Normal file
18
vendor/codexshaper/laravel-woocommerce/src/Facades/Refund.php
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Codexshaper\WooCommerce\Facades;
|
||||
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
class Refund extends Facade
|
||||
{
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'Codexshaper\WooCommerce\Models\Refund';
|
||||
}
|
||||
}
|
||||
18
vendor/codexshaper/laravel-woocommerce/src/Facades/Report.php
vendored
Normal file
18
vendor/codexshaper/laravel-woocommerce/src/Facades/Report.php
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Codexshaper\WooCommerce\Facades;
|
||||
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
class Report extends Facade
|
||||
{
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'Codexshaper\WooCommerce\Models\Report';
|
||||
}
|
||||
}
|
||||
18
vendor/codexshaper/laravel-woocommerce/src/Facades/Review.php
vendored
Normal file
18
vendor/codexshaper/laravel-woocommerce/src/Facades/Review.php
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Codexshaper\WooCommerce\Facades;
|
||||
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
class Review extends Facade
|
||||
{
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'Codexshaper\WooCommerce\Models\Review';
|
||||
}
|
||||
}
|
||||
18
vendor/codexshaper/laravel-woocommerce/src/Facades/Setting.php
vendored
Normal file
18
vendor/codexshaper/laravel-woocommerce/src/Facades/Setting.php
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Codexshaper\WooCommerce\Facades;
|
||||
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
class Setting extends Facade
|
||||
{
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'Codexshaper\WooCommerce\Models\Setting';
|
||||
}
|
||||
}
|
||||
18
vendor/codexshaper/laravel-woocommerce/src/Facades/ShippingMethod.php
vendored
Normal file
18
vendor/codexshaper/laravel-woocommerce/src/Facades/ShippingMethod.php
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Codexshaper\WooCommerce\Facades;
|
||||
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
class ShippingMethod extends Facade
|
||||
{
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'Codexshaper\WooCommerce\Models\ShippingMethod';
|
||||
}
|
||||
}
|
||||
18
vendor/codexshaper/laravel-woocommerce/src/Facades/ShippingZone.php
vendored
Normal file
18
vendor/codexshaper/laravel-woocommerce/src/Facades/ShippingZone.php
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Codexshaper\WooCommerce\Facades;
|
||||
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
class ShippingZone extends Facade
|
||||
{
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'Codexshaper\WooCommerce\Models\ShippingZone';
|
||||
}
|
||||
}
|
||||
18
vendor/codexshaper/laravel-woocommerce/src/Facades/ShippingZoneMethod.php
vendored
Normal file
18
vendor/codexshaper/laravel-woocommerce/src/Facades/ShippingZoneMethod.php
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Codexshaper\WooCommerce\Facades;
|
||||
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
class ShippingZoneMethod extends Facade
|
||||
{
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'Codexshaper\WooCommerce\Models\ShippingZoneMethod';
|
||||
}
|
||||
}
|
||||
18
vendor/codexshaper/laravel-woocommerce/src/Facades/System.php
vendored
Normal file
18
vendor/codexshaper/laravel-woocommerce/src/Facades/System.php
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Codexshaper\WooCommerce\Facades;
|
||||
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
class System extends Facade
|
||||
{
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'Codexshaper\WooCommerce\Models\System';
|
||||
}
|
||||
}
|
||||
18
vendor/codexshaper/laravel-woocommerce/src/Facades/Tag.php
vendored
Normal file
18
vendor/codexshaper/laravel-woocommerce/src/Facades/Tag.php
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Codexshaper\WooCommerce\Facades;
|
||||
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
class Tag extends Facade
|
||||
{
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'Codexshaper\WooCommerce\Models\Tag';
|
||||
}
|
||||
}
|
||||
18
vendor/codexshaper/laravel-woocommerce/src/Facades/Tax.php
vendored
Normal file
18
vendor/codexshaper/laravel-woocommerce/src/Facades/Tax.php
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Codexshaper\WooCommerce\Facades;
|
||||
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
class Tax extends Facade
|
||||
{
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'Codexshaper\WooCommerce\Models\Tax';
|
||||
}
|
||||
}
|
||||
18
vendor/codexshaper/laravel-woocommerce/src/Facades/TaxClass.php
vendored
Normal file
18
vendor/codexshaper/laravel-woocommerce/src/Facades/TaxClass.php
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Codexshaper\WooCommerce\Facades;
|
||||
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
class TaxClass extends Facade
|
||||
{
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'Codexshaper\WooCommerce\Models\TaxClass';
|
||||
}
|
||||
}
|
||||
18
vendor/codexshaper/laravel-woocommerce/src/Facades/Term.php
vendored
Normal file
18
vendor/codexshaper/laravel-woocommerce/src/Facades/Term.php
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Codexshaper\WooCommerce\Facades;
|
||||
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
class Term extends Facade
|
||||
{
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'Codexshaper\WooCommerce\Models\Term';
|
||||
}
|
||||
}
|
||||
18
vendor/codexshaper/laravel-woocommerce/src/Facades/Variation.php
vendored
Normal file
18
vendor/codexshaper/laravel-woocommerce/src/Facades/Variation.php
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Codexshaper\WooCommerce\Facades;
|
||||
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
class Variation extends Facade
|
||||
{
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'Codexshaper\WooCommerce\Models\Variation';
|
||||
}
|
||||
}
|
||||
18
vendor/codexshaper/laravel-woocommerce/src/Facades/Webhook.php
vendored
Normal file
18
vendor/codexshaper/laravel-woocommerce/src/Facades/Webhook.php
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Codexshaper\WooCommerce\Facades;
|
||||
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
class Webhook extends Facade
|
||||
{
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'Codexshaper\WooCommerce\Models\Webhook';
|
||||
}
|
||||
}
|
||||
19
vendor/codexshaper/laravel-woocommerce/src/Facades/WooCommerce.php
vendored
Normal file
19
vendor/codexshaper/laravel-woocommerce/src/Facades/WooCommerce.php
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace Codexshaper\WooCommerce\Facades;
|
||||
|
||||
use Codexshaper\WooCommerce\WooCommerceApi;
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
class WooCommerce extends Facade
|
||||
{
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return WooCommerceApi::class;
|
||||
}
|
||||
}
|
||||
18
vendor/codexshaper/laravel-woocommerce/src/Facades/WoocommerceFacade.php
vendored
Normal file
18
vendor/codexshaper/laravel-woocommerce/src/Facades/WoocommerceFacade.php
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Codexshaper\Woocommerce\Facades;
|
||||
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
class WoocommerceFacade extends Facade
|
||||
{
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'Codexshaper\Woocommerce\WooCommerceApi';
|
||||
}
|
||||
}
|
||||
106
vendor/codexshaper/laravel-woocommerce/src/Models/Attribute.php
vendored
Normal file
106
vendor/codexshaper/laravel-woocommerce/src/Models/Attribute.php
vendored
Normal file
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
|
||||
namespace Codexshaper\WooCommerce\Models;
|
||||
|
||||
use Codexshaper\WooCommerce\Facades\Query;
|
||||
use Codexshaper\WooCommerce\Traits\QueryBuilderTrait;
|
||||
|
||||
class Attribute extends BaseModel
|
||||
{
|
||||
use QueryBuilderTrait;
|
||||
|
||||
protected $endpoint = 'products/attributes';
|
||||
|
||||
/**
|
||||
* Retrieve all Items.
|
||||
*
|
||||
* @param int $attribute_id
|
||||
* @param array $options
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getTerms($attribute_id, $options = [])
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint("products/attributes/{$attribute_id}/terms")
|
||||
->all($options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve single Item.
|
||||
*
|
||||
* @param int $attribute_id
|
||||
* @param int $term_id
|
||||
* @param array $options
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
protected function getTerm($attribute_id, $term_id, $options = [])
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint("products/attributes/{$attribute_id}/terms")
|
||||
->find($term_id, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create new Item.
|
||||
*
|
||||
* @param int $attribute_id
|
||||
* @param array $data
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
protected function addTerm($attribute_id, $data)
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint("products/attributes/{$attribute_id}/terms")
|
||||
->create($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update Existing Item.
|
||||
*
|
||||
* @param int $attribute_id
|
||||
* @param int $term_id
|
||||
* @param array $data
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
protected function updateTerm($attribute_id, $term_id, $data)
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint("products/attributes/{$attribute_id}/terms")
|
||||
->update($term_id, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy Item.
|
||||
*
|
||||
* @param int $attribute_id
|
||||
* @param int $term_id
|
||||
* @param array $options
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
protected function deleteTerm($attribute_id, $term_id, $options = [])
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint("products/attributes/{$attribute_id}/terms")
|
||||
->delete($term_id, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Batch Update.
|
||||
*
|
||||
* @param int $attribute_id
|
||||
* @param array $data
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
protected function batchTerm($attribute_id, $data)
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint("products/attributes/{$attribute_id}/terms")
|
||||
->batch($data);
|
||||
}
|
||||
}
|
||||
52
vendor/codexshaper/laravel-woocommerce/src/Models/BaseModel.php
vendored
Normal file
52
vendor/codexshaper/laravel-woocommerce/src/Models/BaseModel.php
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace Codexshaper\WooCommerce\Models;
|
||||
|
||||
class BaseModel
|
||||
{
|
||||
protected $properties = [];
|
||||
|
||||
/**
|
||||
* Get Inaccessible Property.
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return int|string|array|object|null
|
||||
*/
|
||||
public function __get($name)
|
||||
{
|
||||
return $this->$name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Option.
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __set($name, $value)
|
||||
{
|
||||
$this->properties[$name] = $value;
|
||||
}
|
||||
|
||||
public function __call($method, $parameters)
|
||||
{
|
||||
if (!method_exists($this, $method)) {
|
||||
preg_match_all('/((?:^|[A-Z])[a-z]+)/', $method, $partials);
|
||||
$method = array_shift($partials[0]);
|
||||
if (!method_exists($this, $method)) {
|
||||
throw new \Exception('Sorry! you are calling wrong method');
|
||||
}
|
||||
array_unshift($parameters, strtolower(implode('_', $partials[0])));
|
||||
}
|
||||
|
||||
return $this->$method(...$parameters);
|
||||
}
|
||||
|
||||
public static function __callStatic($method, $parameters)
|
||||
{
|
||||
return (new static())->$method(...$parameters);
|
||||
}
|
||||
}
|
||||
12
vendor/codexshaper/laravel-woocommerce/src/Models/Category.php
vendored
Normal file
12
vendor/codexshaper/laravel-woocommerce/src/Models/Category.php
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Codexshaper\WooCommerce\Models;
|
||||
|
||||
use Codexshaper\WooCommerce\Traits\QueryBuilderTrait;
|
||||
|
||||
class Category extends BaseModel
|
||||
{
|
||||
use QueryBuilderTrait;
|
||||
|
||||
protected $endpoint = 'products/categories';
|
||||
}
|
||||
12
vendor/codexshaper/laravel-woocommerce/src/Models/Coupon.php
vendored
Normal file
12
vendor/codexshaper/laravel-woocommerce/src/Models/Coupon.php
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Codexshaper\WooCommerce\Models;
|
||||
|
||||
use Codexshaper\WooCommerce\Traits\QueryBuilderTrait;
|
||||
|
||||
class Coupon extends BaseModel
|
||||
{
|
||||
use QueryBuilderTrait;
|
||||
|
||||
protected $endpoint = 'coupons';
|
||||
}
|
||||
27
vendor/codexshaper/laravel-woocommerce/src/Models/Customer.php
vendored
Normal file
27
vendor/codexshaper/laravel-woocommerce/src/Models/Customer.php
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Codexshaper\WooCommerce\Models;
|
||||
|
||||
use Codexshaper\WooCommerce\Facades\Query;
|
||||
use Codexshaper\WooCommerce\Traits\QueryBuilderTrait;
|
||||
|
||||
class Customer extends BaseModel
|
||||
{
|
||||
use QueryBuilderTrait;
|
||||
|
||||
protected $endpoint = 'customers';
|
||||
|
||||
/**
|
||||
* Download.
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
protected function downloads($id, $options = [])
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint("customers/{$id}/downloads")
|
||||
->all($options);
|
||||
}
|
||||
}
|
||||
125
vendor/codexshaper/laravel-woocommerce/src/Models/Note.php
vendored
Normal file
125
vendor/codexshaper/laravel-woocommerce/src/Models/Note.php
vendored
Normal file
@@ -0,0 +1,125 @@
|
||||
<?php
|
||||
|
||||
namespace Codexshaper\WooCommerce\Models;
|
||||
|
||||
use Codexshaper\WooCommerce\Facades\Query;
|
||||
use Codexshaper\WooCommerce\Traits\QueryBuilderTrait;
|
||||
|
||||
class Note extends BaseModel
|
||||
{
|
||||
use QueryBuilderTrait;
|
||||
|
||||
protected $endpoint;
|
||||
|
||||
/**
|
||||
* Retrieve all Items.
|
||||
*
|
||||
* @param int $order_id
|
||||
* @param array $options
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function all($order_id, $options = [])
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint("orders/{$order_id}/notes")
|
||||
->all($options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve single Item.
|
||||
*
|
||||
* @param int $order_id
|
||||
* @param int $note_id
|
||||
* @param array $options
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
protected function find($order_id, $note_id, $options = [])
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint("orders/{$order_id}/notes")
|
||||
->find($note_id, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create new Item.
|
||||
*
|
||||
* @param int $order_id
|
||||
* @param array $data
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
protected function create($order_id, $data)
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint("orders/{$order_id}/notes")
|
||||
->create($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy Item.
|
||||
*
|
||||
* @param int $order_id
|
||||
* @param int $note_id
|
||||
* @param array $options
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
protected function delete($order_id, $note_id, $options = [])
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint("orders/{$order_id}/notes")
|
||||
->delete($note_id, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Paginate results.
|
||||
*
|
||||
*
|
||||
* @param int $order_id
|
||||
* @param int $per_page
|
||||
* @param int $current_page
|
||||
* @param array $options
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function paginate(
|
||||
$order_id,
|
||||
$per_page = 10,
|
||||
$current_page = 1,
|
||||
$options = []
|
||||
) {
|
||||
return Query::init()
|
||||
->setEndpoint("orders/{$order_id}/notes")
|
||||
->paginate($per_page, $current_page, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Count all results.
|
||||
*
|
||||
* @param int $order_id
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
protected function count($order_id)
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint("orders/{$order_id}/notes")
|
||||
->count();
|
||||
}
|
||||
|
||||
/**
|
||||
* Store data.
|
||||
*
|
||||
* @param int $order_id
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function save($order_id)
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint("orders/{$order_id}/notes")
|
||||
->save();
|
||||
}
|
||||
}
|
||||
137
vendor/codexshaper/laravel-woocommerce/src/Models/Order.php
vendored
Normal file
137
vendor/codexshaper/laravel-woocommerce/src/Models/Order.php
vendored
Normal file
@@ -0,0 +1,137 @@
|
||||
<?php
|
||||
|
||||
namespace Codexshaper\WooCommerce\Models;
|
||||
|
||||
use Codexshaper\WooCommerce\Facades\Query;
|
||||
use Codexshaper\WooCommerce\Traits\QueryBuilderTrait;
|
||||
|
||||
class Order extends BaseModel
|
||||
{
|
||||
use QueryBuilderTrait;
|
||||
|
||||
protected $endpoint = 'orders';
|
||||
|
||||
/**
|
||||
* Retrieve all notes.
|
||||
*
|
||||
* @param int $order_id
|
||||
* @param array $options
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function notes($order_id, $options = [])
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint("orders/{$order_id}/notes")
|
||||
->all($options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retreive a note.
|
||||
*
|
||||
* @param int $order_id
|
||||
* @param int $note_id
|
||||
* @param array $options
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
protected function note($order_id, $note_id, $options = [])
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint("orders/{$order_id}/notes")
|
||||
->find($note_id, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a note.
|
||||
*
|
||||
* @param int $order_id
|
||||
* @param array $data
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
protected function createNote($order_id, $data = [])
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint("orders/{$order_id}/notes")
|
||||
->create($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a note.
|
||||
*
|
||||
* @param int $order_id
|
||||
* @param int $note_id
|
||||
* @param array $options
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
protected function deleteNote($order_id, $note_id, $options = [])
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint("orders/{$order_id}/notes")
|
||||
->delete($note_id, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve all refunds.
|
||||
*
|
||||
* @param int $order_id
|
||||
* @param array $options
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function refunds($order_id, $options = [])
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint("orders/{$order_id}/refunds")
|
||||
->all($options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve a refund.
|
||||
*
|
||||
* @param int $order_id
|
||||
* @param int $refund_id
|
||||
* @param array $options
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
protected function refund($order_id, $refund_id, $options = [])
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint("orders/{$order_id}/refunds")
|
||||
->find($refund_id, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create refund.
|
||||
*
|
||||
* @param int $order_id
|
||||
* @param array $data
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
protected function createRefund($order_id, $data = [])
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint("orders/{$order_id}/refunds")
|
||||
->create($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete refund.
|
||||
*
|
||||
* @param int $order_id
|
||||
* @param int $refund_id
|
||||
* @param array $options
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
protected function deleteRefund($order_id, $refund_id, $options = [])
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint("orders/{$order_id}/refunds")
|
||||
->delete($refund_id, $options);
|
||||
}
|
||||
}
|
||||
12
vendor/codexshaper/laravel-woocommerce/src/Models/PaymentGateway.php
vendored
Normal file
12
vendor/codexshaper/laravel-woocommerce/src/Models/PaymentGateway.php
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Codexshaper\WooCommerce\Models;
|
||||
|
||||
use Codexshaper\WooCommerce\Traits\QueryBuilderTrait;
|
||||
|
||||
class PaymentGateway extends BaseModel
|
||||
{
|
||||
use QueryBuilderTrait;
|
||||
|
||||
protected $endpoint = 'payment_gateways';
|
||||
}
|
||||
12
vendor/codexshaper/laravel-woocommerce/src/Models/Product.php
vendored
Normal file
12
vendor/codexshaper/laravel-woocommerce/src/Models/Product.php
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Codexshaper\WooCommerce\Models;
|
||||
|
||||
use Codexshaper\WooCommerce\Traits\QueryBuilderTrait;
|
||||
|
||||
class Product extends BaseModel
|
||||
{
|
||||
use QueryBuilderTrait;
|
||||
|
||||
protected $endpoint = 'products';
|
||||
}
|
||||
124
vendor/codexshaper/laravel-woocommerce/src/Models/Refund.php
vendored
Normal file
124
vendor/codexshaper/laravel-woocommerce/src/Models/Refund.php
vendored
Normal file
@@ -0,0 +1,124 @@
|
||||
<?php
|
||||
|
||||
namespace Codexshaper\WooCommerce\Models;
|
||||
|
||||
use Codexshaper\WooCommerce\Facades\Query;
|
||||
use Codexshaper\WooCommerce\Traits\QueryBuilderTrait;
|
||||
|
||||
class Refund extends BaseModel
|
||||
{
|
||||
use QueryBuilderTrait;
|
||||
|
||||
protected $endpoint;
|
||||
|
||||
/**
|
||||
* Retrieve all Items.
|
||||
*
|
||||
* @param int $order_id
|
||||
* @param array $options
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function all($order_id, $options = [])
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint("orders/{$order_id}/refunds")
|
||||
->all($options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve single Item.
|
||||
*
|
||||
* @param int $order_id
|
||||
* @param int $refund_id
|
||||
* @param array $options
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
protected function find($order_id, $refund_id, $options = [])
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint("orders/{$order_id}/refunds")
|
||||
->find($refund_id, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create new Item.
|
||||
*
|
||||
* @param int $order_id
|
||||
* @param array $data
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
protected function create($order_id, $data)
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint("orders/{$order_id}/refunds")
|
||||
->create($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy Item.
|
||||
*
|
||||
* @param int $order_id
|
||||
* @param int $refund_id
|
||||
* @param array $options
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
protected function delete($order_id, $refund_id, $options = [])
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint("orders/{$order_id}/refunds")
|
||||
->delete($refund_id, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Paginate results.
|
||||
*
|
||||
* @param int $order_id
|
||||
* @param int $per_page
|
||||
* @param int $current_page
|
||||
* @param array $options
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function paginate(
|
||||
$order_id,
|
||||
$per_page = 10,
|
||||
$current_page = 1,
|
||||
$options = []
|
||||
) {
|
||||
return Query::init()
|
||||
->setEndpoint("orders/{$order_id}/refunds")
|
||||
->paginate($per_page, $current_page, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Count all results.
|
||||
*
|
||||
* @param int $order_id
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
protected function count($order_id)
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint("orders/{$order_id}/refunds")
|
||||
->count();
|
||||
}
|
||||
|
||||
/**
|
||||
* Store data.
|
||||
*
|
||||
* @param int $order_id
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function save($order_id)
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint("orders/{$order_id}/refunds")
|
||||
->save();
|
||||
}
|
||||
}
|
||||
111
vendor/codexshaper/laravel-woocommerce/src/Models/Report.php
vendored
Normal file
111
vendor/codexshaper/laravel-woocommerce/src/Models/Report.php
vendored
Normal file
@@ -0,0 +1,111 @@
|
||||
<?php
|
||||
|
||||
namespace Codexshaper\WooCommerce\Models;
|
||||
|
||||
use Codexshaper\WooCommerce\Facades\Query;
|
||||
use Codexshaper\WooCommerce\Traits\QueryBuilderTrait;
|
||||
|
||||
class Report extends BaseModel
|
||||
{
|
||||
use QueryBuilderTrait;
|
||||
|
||||
protected $endpoint = 'reports';
|
||||
|
||||
/**
|
||||
* Retrieve all sales.
|
||||
*
|
||||
* @param array $options
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function sales($options = [])
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint('reports/sales')
|
||||
->all($options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve all top sellers.
|
||||
*
|
||||
* @param array $options
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function topSellers($options = [])
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint('reports/top_sellers')
|
||||
->all($options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve all coupons.
|
||||
*
|
||||
* @param array $options
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function coupons($options = [])
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint('reports/coupons/totals')
|
||||
->all($options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve all customers.
|
||||
*
|
||||
* @param array $options
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function customers($options = [])
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint('reports/customers/totals')
|
||||
->all($options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve all orders.
|
||||
*
|
||||
* @param array $options
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function orders($options = [])
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint('reports/orders/totals')
|
||||
->all($options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve all products.
|
||||
*
|
||||
* @param array $options
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function products($options = [])
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint('reports/products/totals')
|
||||
->all($options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve all reviews.
|
||||
*
|
||||
* @param array $options
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function reviews($options = [])
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint('reports/reviews/totals')
|
||||
->all($options);
|
||||
}
|
||||
}
|
||||
12
vendor/codexshaper/laravel-woocommerce/src/Models/Review.php
vendored
Normal file
12
vendor/codexshaper/laravel-woocommerce/src/Models/Review.php
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Codexshaper\WooCommerce\Models;
|
||||
|
||||
use Codexshaper\WooCommerce\Traits\QueryBuilderTrait;
|
||||
|
||||
class Review extends BaseModel
|
||||
{
|
||||
use QueryBuilderTrait;
|
||||
|
||||
protected $endpoint = 'products/reviews';
|
||||
}
|
||||
74
vendor/codexshaper/laravel-woocommerce/src/Models/Setting.php
vendored
Normal file
74
vendor/codexshaper/laravel-woocommerce/src/Models/Setting.php
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
namespace Codexshaper\WooCommerce\Models;
|
||||
|
||||
use Codexshaper\WooCommerce\Facades\Query;
|
||||
use Codexshaper\WooCommerce\Traits\QueryBuilderTrait;
|
||||
|
||||
class Setting extends BaseModel
|
||||
{
|
||||
use QueryBuilderTrait;
|
||||
|
||||
protected $endpoint = 'settings';
|
||||
|
||||
/**
|
||||
* Retrieve option.
|
||||
*
|
||||
* @param int $group_id
|
||||
* @param int $id
|
||||
* @param array $options
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function option($group_id, $id, $options = [])
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint("settings/{$group_id}")
|
||||
->find($id, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve options.
|
||||
*
|
||||
* @param int $id
|
||||
* @param array $options
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function options($id, $options = [])
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint('settings')
|
||||
->find($id, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update Existing Item.
|
||||
*
|
||||
* @param int $group_id
|
||||
* @param int $id
|
||||
* @param array $data
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
protected function update($group_id, $id, $data)
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint("settings/{$group_id}")
|
||||
->update($id, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Batch Update.
|
||||
*
|
||||
* @param array $data
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
protected function batch($id, $data)
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint("settings/{$id}")
|
||||
->batch($data);
|
||||
}
|
||||
}
|
||||
12
vendor/codexshaper/laravel-woocommerce/src/Models/ShippingMethod.php
vendored
Normal file
12
vendor/codexshaper/laravel-woocommerce/src/Models/ShippingMethod.php
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Codexshaper\WooCommerce\Models;
|
||||
|
||||
use Codexshaper\WooCommerce\Traits\QueryBuilderTrait;
|
||||
|
||||
class ShippingMethod extends BaseModel
|
||||
{
|
||||
use QueryBuilderTrait;
|
||||
|
||||
protected $endpoint = 'shipping_methods';
|
||||
}
|
||||
120
vendor/codexshaper/laravel-woocommerce/src/Models/ShippingZone.php
vendored
Normal file
120
vendor/codexshaper/laravel-woocommerce/src/Models/ShippingZone.php
vendored
Normal file
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
|
||||
namespace Codexshaper\WooCommerce\Models;
|
||||
|
||||
use Codexshaper\WooCommerce\Facades\Query;
|
||||
use Codexshaper\WooCommerce\Facades\WooCommerce;
|
||||
use Codexshaper\WooCommerce\Traits\QueryBuilderTrait;
|
||||
|
||||
class ShippingZone extends BaseModel
|
||||
{
|
||||
use QueryBuilderTrait;
|
||||
|
||||
protected $endpoint = 'shipping/zones';
|
||||
|
||||
/**
|
||||
* Retrieve all Items.
|
||||
*
|
||||
* @param int $id
|
||||
* @param array $options
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getLocations($id, $options = [])
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint("shipping/zones/{$id}/locations")
|
||||
->all($options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update Existing Item.
|
||||
*
|
||||
* @param int $id
|
||||
* @param array $data
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
protected function updateLocations($id, $data = [])
|
||||
{
|
||||
return WooCommerce::update("shipping/zones/{$id}/locations", $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create new Item.
|
||||
*
|
||||
* @param int $id
|
||||
* @param array $data
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
protected function addShippingZoneMethod($id, $data)
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint("shipping/zones/{$id}/methods")
|
||||
->create($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve single Item.
|
||||
*
|
||||
* @param int $zone_id
|
||||
* @param int $id
|
||||
* @param array $options
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
protected function getShippingZoneMethod($zone_id, $id, $options = [])
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint("shipping/zones/{$zone_id}/methods")
|
||||
->find($id, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve all Items.
|
||||
*
|
||||
* @param int $id
|
||||
* @param array $options
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getShippingZoneMethods($id, $options = [])
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint("shipping/zones/{$id}/methods")
|
||||
->all($options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update Existing Item.
|
||||
*
|
||||
* @param int $zone_id
|
||||
* @param int $id
|
||||
* @param array $data
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
protected function updateShippingZoneMethod($zone_id, $id, $data = [])
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint("shipping/zones/{$zone_id}/methods")
|
||||
->update($id, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy Item.
|
||||
*
|
||||
* @param int $zone_id
|
||||
* @param int $id
|
||||
* @param array $options
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
protected function deleteShippingZoneMethod($zone_id, $id, $options = [])
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint("shipping/zones/{$zone_id}/methods")
|
||||
->delete($id, $options);
|
||||
}
|
||||
}
|
||||
71
vendor/codexshaper/laravel-woocommerce/src/Models/System.php
vendored
Normal file
71
vendor/codexshaper/laravel-woocommerce/src/Models/System.php
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace Codexshaper\WooCommerce\Models;
|
||||
|
||||
use Codexshaper\WooCommerce\Facades\Query;
|
||||
use Codexshaper\WooCommerce\Traits\QueryBuilderTrait;
|
||||
|
||||
class System extends BaseModel
|
||||
{
|
||||
use QueryBuilderTrait;
|
||||
|
||||
protected $endpoint;
|
||||
|
||||
/**
|
||||
* Retrieve all Items.
|
||||
*
|
||||
* @param array $options
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function status($options = [])
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint('system_status')
|
||||
->all($options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve single tool.
|
||||
*
|
||||
* @param int $id
|
||||
* @param array $options
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
protected function tool($id, $options = [])
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint('system_status/tools')
|
||||
->find($id, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve all tools.
|
||||
*
|
||||
* @param array $options
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function tools($options = [])
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint('system_status/tools')
|
||||
->all($options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Run tool.
|
||||
*
|
||||
* @param int $id
|
||||
* @param array $data
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
protected function run($id, $data)
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint('system_status/tools')
|
||||
->update($id, $data);
|
||||
}
|
||||
}
|
||||
12
vendor/codexshaper/laravel-woocommerce/src/Models/Tag.php
vendored
Normal file
12
vendor/codexshaper/laravel-woocommerce/src/Models/Tag.php
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Codexshaper\WooCommerce\Models;
|
||||
|
||||
use Codexshaper\WooCommerce\Traits\QueryBuilderTrait;
|
||||
|
||||
class Tag extends BaseModel
|
||||
{
|
||||
use QueryBuilderTrait;
|
||||
|
||||
protected $endpoint = 'products/tags';
|
||||
}
|
||||
12
vendor/codexshaper/laravel-woocommerce/src/Models/Tax.php
vendored
Normal file
12
vendor/codexshaper/laravel-woocommerce/src/Models/Tax.php
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Codexshaper\WooCommerce\Models;
|
||||
|
||||
use Codexshaper\WooCommerce\Traits\QueryBuilderTrait;
|
||||
|
||||
class Tax extends BaseModel
|
||||
{
|
||||
use QueryBuilderTrait;
|
||||
|
||||
protected $endpoint = 'taxes';
|
||||
}
|
||||
12
vendor/codexshaper/laravel-woocommerce/src/Models/TaxClass.php
vendored
Normal file
12
vendor/codexshaper/laravel-woocommerce/src/Models/TaxClass.php
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Codexshaper\WooCommerce\Models;
|
||||
|
||||
use Codexshaper\WooCommerce\Traits\QueryBuilderTrait;
|
||||
|
||||
class TaxClass extends BaseModel
|
||||
{
|
||||
use QueryBuilderTrait;
|
||||
|
||||
protected $endpoint = 'taxes/classes';
|
||||
}
|
||||
155
vendor/codexshaper/laravel-woocommerce/src/Models/Term.php
vendored
Normal file
155
vendor/codexshaper/laravel-woocommerce/src/Models/Term.php
vendored
Normal file
@@ -0,0 +1,155 @@
|
||||
<?php
|
||||
|
||||
namespace Codexshaper\WooCommerce\Models;
|
||||
|
||||
use Codexshaper\WooCommerce\Facades\Query;
|
||||
use Codexshaper\WooCommerce\Traits\QueryBuilderTrait;
|
||||
|
||||
class Term extends BaseModel
|
||||
{
|
||||
use QueryBuilderTrait;
|
||||
|
||||
protected $endpoint;
|
||||
|
||||
/**
|
||||
* Retrieve all Items.
|
||||
*
|
||||
* @param int $attribute_id
|
||||
* @param array $options
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function all($attribute_id, $options = [])
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint("products/attributes/{$attribute_id}/terms")
|
||||
->all($options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve single Item.
|
||||
*
|
||||
* @param int $attribute_id
|
||||
* @param int $id
|
||||
* @param array $options
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
protected function find($attribute_id, $id, $options = [])
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint("products/attributes/{$attribute_id}/terms")
|
||||
->find($id, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create new Item.
|
||||
*
|
||||
* @param int $attribute_id
|
||||
* @param array $data
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
protected function create($attribute_id, $data)
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint("products/attributes/{$attribute_id}/terms")
|
||||
->create($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update Existing Item.
|
||||
*
|
||||
* @param int $attribute_id
|
||||
* @param int $id
|
||||
* @param array $data
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
protected function update($attribute_id, $id, $data)
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint("products/attributes/{$attribute_id}/terms")
|
||||
->update($id, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy Item.
|
||||
*
|
||||
* @param int $attribute_id
|
||||
* @param int $id
|
||||
* @param array $options
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
protected function delete($attribute_id, $id, $options = [])
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint("products/attributes/{$attribute_id}/terms")
|
||||
->delete($id, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Batch Update.
|
||||
*
|
||||
* @param int $attribute_id
|
||||
* @param array $data
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
protected function batch($attribute_id, $data)
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint("products/attributes/{$attribute_id}/terms")
|
||||
->batch($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Paginate results.
|
||||
*
|
||||
* @param int $attribute_id
|
||||
* @param int $per_page
|
||||
* @param int $current_page
|
||||
* @param array $options
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function paginate(
|
||||
$attribute_id,
|
||||
$per_page = 10,
|
||||
$current_page = 1,
|
||||
$options = []
|
||||
) {
|
||||
return Query::init()
|
||||
->setEndpoint("products/attributes/{$attribute_id}/terms")
|
||||
->paginate($per_page, $current_page, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Count all results.
|
||||
*
|
||||
* @param int $attribute_id
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
protected function count($attribute_id)
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint("products/attributes/{$attribute_id}/terms")
|
||||
->count();
|
||||
}
|
||||
|
||||
/**
|
||||
* Store data.
|
||||
*
|
||||
* @param int $attribute_id
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function save($attribute_id)
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint("products/attributes/{$attribute_id}/terms")
|
||||
->save();
|
||||
}
|
||||
}
|
||||
155
vendor/codexshaper/laravel-woocommerce/src/Models/Variation.php
vendored
Normal file
155
vendor/codexshaper/laravel-woocommerce/src/Models/Variation.php
vendored
Normal file
@@ -0,0 +1,155 @@
|
||||
<?php
|
||||
|
||||
namespace Codexshaper\WooCommerce\Models;
|
||||
|
||||
use Codexshaper\WooCommerce\Facades\Query;
|
||||
use Codexshaper\WooCommerce\Traits\QueryBuilderTrait;
|
||||
|
||||
class Variation extends BaseModel
|
||||
{
|
||||
use QueryBuilderTrait;
|
||||
|
||||
protected $endpoint;
|
||||
|
||||
/**
|
||||
* Retrieve all Items.
|
||||
*
|
||||
* @param int $product_id
|
||||
* @param array $options
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function all($product_id, $options = [])
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint("products/{$product_id}/variations")
|
||||
->all($options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve single Item.
|
||||
*
|
||||
* @param int $product_id
|
||||
* @param int $id
|
||||
* @param array $options
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
protected function find($product_id, $id, $options = [])
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint("products/{$product_id}/variations")
|
||||
->find($id, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create new Item.
|
||||
*
|
||||
* @param int $product_id
|
||||
* @param array $data
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
protected function create($product_id, $data)
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint("products/{$product_id}/variations")
|
||||
->create($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update Existing Item.
|
||||
*
|
||||
* @param int $product_id
|
||||
* @param int $id
|
||||
* @param array $data
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
protected function update($product_id, $id, $data)
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint("products/{$product_id}/variations")
|
||||
->update($id, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy Item.
|
||||
*
|
||||
* @param int $product_id
|
||||
* @param int $id
|
||||
* @param array $options
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
protected function delete($product_id, $id, $options = [])
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint("products/{$product_id}/variations")
|
||||
->delete($id, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Batch Update.
|
||||
*
|
||||
* @param int $product_id
|
||||
* @param array $data
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
protected function batch($product_id, $data)
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint("products/{$product_id}/variations")
|
||||
->batch($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Paginate results.
|
||||
*
|
||||
* @param int $product_id
|
||||
* @param int $per_page
|
||||
* @param int $current_page
|
||||
* @param array $options
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function paginate(
|
||||
$product_id,
|
||||
$per_page = 10,
|
||||
$current_page = 1,
|
||||
$options = []
|
||||
) {
|
||||
return Query::init()
|
||||
->setEndpoint("products/{$product_id}/variations")
|
||||
->paginate($per_page, $current_page, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Count all results.
|
||||
*
|
||||
* @param int $product_id
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
protected function count($product_id)
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint("products/{$product_id}/variations")
|
||||
->count();
|
||||
}
|
||||
|
||||
/**
|
||||
* Store data.
|
||||
*
|
||||
* @param int $product_id
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function save($product_id)
|
||||
{
|
||||
return Query::init()
|
||||
->setEndpoint("products/{$product_id}/variations")
|
||||
->save();
|
||||
}
|
||||
}
|
||||
12
vendor/codexshaper/laravel-woocommerce/src/Models/Webhook.php
vendored
Normal file
12
vendor/codexshaper/laravel-woocommerce/src/Models/Webhook.php
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Codexshaper\WooCommerce\Models;
|
||||
|
||||
use Codexshaper\WooCommerce\Traits\QueryBuilderTrait;
|
||||
|
||||
class Webhook extends BaseModel
|
||||
{
|
||||
use QueryBuilderTrait;
|
||||
|
||||
protected $endpoint = 'webhooks';
|
||||
}
|
||||
35
vendor/codexshaper/laravel-woocommerce/src/Query.php
vendored
Normal file
35
vendor/codexshaper/laravel-woocommerce/src/Query.php
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Codexshaper\WooCommerce;
|
||||
|
||||
use Codexshaper\WooCommerce\Models\BaseMOdel;
|
||||
use Codexshaper\WooCommerce\Traits\QueryBuilderTrait;
|
||||
|
||||
class Query extends BaseMOdel
|
||||
{
|
||||
use QueryBuilderTrait;
|
||||
|
||||
protected $endpoint;
|
||||
protected static $instance = null;
|
||||
|
||||
public function __construct($endpoint = '')
|
||||
{
|
||||
$this->endpoint = $endpoint;
|
||||
}
|
||||
|
||||
public function setEndpoint($endpoint)
|
||||
{
|
||||
$this->endpoint = $endpoint;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function init()
|
||||
{
|
||||
if (!static::$instance) {
|
||||
static::$instance = new static();
|
||||
}
|
||||
|
||||
return static::$instance;
|
||||
}
|
||||
}
|
||||
402
vendor/codexshaper/laravel-woocommerce/src/Traits/QueryBuilderTrait.php
vendored
Normal file
402
vendor/codexshaper/laravel-woocommerce/src/Traits/QueryBuilderTrait.php
vendored
Normal file
@@ -0,0 +1,402 @@
|
||||
<?php
|
||||
|
||||
namespace Codexshaper\WooCommerce\Traits;
|
||||
|
||||
use Codexshaper\WooCommerce\Facades\WooCommerce;
|
||||
use Illuminate\Support\LazyCollection;
|
||||
|
||||
trait QueryBuilderTrait
|
||||
{
|
||||
/**
|
||||
* @var
|
||||
*/
|
||||
protected $options = [];
|
||||
|
||||
/**
|
||||
* @var
|
||||
*/
|
||||
protected $where = [];
|
||||
|
||||
/**
|
||||
* @var
|
||||
*/
|
||||
protected $properties = [];
|
||||
|
||||
/**
|
||||
* @var
|
||||
*/
|
||||
protected $isLazyCollection = false;
|
||||
|
||||
/**
|
||||
* @var
|
||||
*/
|
||||
protected $isCollection = true;
|
||||
|
||||
/**
|
||||
* @var
|
||||
*/
|
||||
protected $isOriginal = false;
|
||||
|
||||
/**
|
||||
* Retrieve all Items.
|
||||
*
|
||||
* @param array $options
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function all($options = [])
|
||||
{
|
||||
if ($this->isLazyCollection) {
|
||||
return LazyCollection::make(WooCommerce::all($this->endpoint, $options));
|
||||
}
|
||||
|
||||
if ($this->isCollection) {
|
||||
return collect(WooCommerce::all($this->endpoint, $options));
|
||||
}
|
||||
|
||||
return WooCommerce::all($this->endpoint, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve single Item.
|
||||
*
|
||||
* @param int $id
|
||||
* @param array $options
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
protected function find($id, $options = [])
|
||||
{
|
||||
if ($this->isLazyCollection) {
|
||||
return LazyCollection::make(WooCommerce::find("{$this->endpoint}/{$id}", $options));
|
||||
}
|
||||
|
||||
if ($this->isCollection) {
|
||||
return collect(WooCommerce::find("{$this->endpoint}/{$id}", $options));
|
||||
}
|
||||
|
||||
return WooCommerce::find("{$this->endpoint}/{$id}", $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create new Item.
|
||||
*
|
||||
* @param array $data
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
protected function create($data)
|
||||
{
|
||||
if ($this->isLazyCollection) {
|
||||
return LazyCollection::make(WooCommerce::create($this->endpoint, $data));
|
||||
}
|
||||
|
||||
if ($this->isCollection) {
|
||||
return collect(WooCommerce::create($this->endpoint, $data));
|
||||
}
|
||||
|
||||
return WooCommerce::create($this->endpoint, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update Existing Item.
|
||||
*
|
||||
* @param int $id
|
||||
* @param array $data
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
protected function update($id, $data)
|
||||
{
|
||||
if ($this->isLazyCollection) {
|
||||
return LazyCollection::make(WooCommerce::update("{$this->endpoint}/{$id}", $data));
|
||||
}
|
||||
|
||||
if ($this->isCollection) {
|
||||
return collect(WooCommerce::update("{$this->endpoint}/{$id}", $data));
|
||||
}
|
||||
|
||||
return WooCommerce::update("{$this->endpoint}/{$id}", $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy Item.
|
||||
*
|
||||
* @param int $id
|
||||
* @param array $options
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
protected function delete($id, $options = [])
|
||||
{
|
||||
if ($this->isLazyCollection) {
|
||||
return LazyCollection::make(WooCommerce::delete("{$this->endpoint}/{$id}", $options));
|
||||
}
|
||||
|
||||
if ($this->isCollection) {
|
||||
return collect(WooCommerce::delete("{$this->endpoint}/{$id}", $options));
|
||||
}
|
||||
|
||||
return WooCommerce::delete("{$this->endpoint}/{$id}", $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Batch Update.
|
||||
*
|
||||
* @param array $data
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
protected function batch($data)
|
||||
{
|
||||
if ($this->isLazyCollection) {
|
||||
return LazyCollection::make(WooCommerce::create("{$this->endpoint}/batch", $data));
|
||||
}
|
||||
|
||||
if ($this->isCollection) {
|
||||
return collect(WooCommerce::create("{$this->endpoint}/batch", $data));
|
||||
}
|
||||
|
||||
return WooCommerce::create("{$this->endpoint}/batch", $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve data.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function get()
|
||||
{
|
||||
if ($this->isLazyCollection) {
|
||||
return LazyCollection::make(WooCommerce::all($this->endpoint, $this->options));
|
||||
}
|
||||
|
||||
if ($this->isCollection) {
|
||||
return collect(WooCommerce::all($this->endpoint, $this->options));
|
||||
}
|
||||
|
||||
return WooCommerce::all($this->endpoint, $this->options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve data.
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
protected function first()
|
||||
{
|
||||
if ($this->isLazyCollection) {
|
||||
return LazyCollection::make($this->get()[0] ?? new \stdClass());
|
||||
}
|
||||
|
||||
if ($this->isCollection) {
|
||||
return collect($this->get()[0] ?? new \stdClass());
|
||||
}
|
||||
|
||||
return collect($this->get()[0] ?? new \stdClass());
|
||||
}
|
||||
|
||||
/**
|
||||
* Set original.
|
||||
*
|
||||
* @return object $this
|
||||
*/
|
||||
protected function withOriginal()
|
||||
{
|
||||
$this->isOriginal = true;
|
||||
$this->isCollection = false;
|
||||
$this->isLazyCollection = false;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set collection.
|
||||
*
|
||||
* @return object $this
|
||||
*/
|
||||
protected function withCollection()
|
||||
{
|
||||
$this->isOriginal = false;
|
||||
$this->isCollection = true;
|
||||
$this->isLazyCollection = false;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set lazy collection.
|
||||
*
|
||||
* @return object $this
|
||||
*/
|
||||
protected function withLazyCollection()
|
||||
{
|
||||
$this->isOriginal = false;
|
||||
$this->isCollection = false;
|
||||
$this->isLazyCollection = true;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set options for woocommerce request.
|
||||
*
|
||||
* @param array $parameters
|
||||
*
|
||||
* @return object $this
|
||||
*/
|
||||
protected function options($parameters)
|
||||
{
|
||||
if (!is_array($parameters)) {
|
||||
throw new \Exception('Options must be an array', 1);
|
||||
}
|
||||
|
||||
if (empty($parameters)) {
|
||||
throw new \Exception('Options must be pass at least one element', 1);
|
||||
}
|
||||
|
||||
foreach ($parameters as $key => $value) {
|
||||
$this->options[$key] = $value;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Join options for woocommerce request.
|
||||
*
|
||||
* @param array $parameters
|
||||
*
|
||||
* @return object $this
|
||||
*/
|
||||
protected function where(...$parameters)
|
||||
{
|
||||
if (count($parameters) < 2 || count($parameters) > 3) {
|
||||
throw new \Exception('You can pass minimum 2 and maximum 3 paramneters');
|
||||
}
|
||||
$field = strtolower($parameters[0]);
|
||||
$value = count($parameters) == 3 ? $parameters[2] : $parameters[1];
|
||||
|
||||
switch ($field) {
|
||||
case 'name': case 'title': case 'description':
|
||||
$this->options['search'] = $value;
|
||||
break;
|
||||
default:
|
||||
$this->options[$field] = $value;
|
||||
break;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set order direction.
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $direction
|
||||
*
|
||||
* @return object $this
|
||||
*/
|
||||
protected function orderBy($name, $direction = 'desc')
|
||||
{
|
||||
$this->options['orderby'] = $name;
|
||||
$this->options['order'] = $direction;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Paginate results.
|
||||
*
|
||||
* @param int $per_page
|
||||
* @param int $current_page
|
||||
* @param array $options
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function paginate($per_page = 10, $current_page = 1, $options = [])
|
||||
{
|
||||
try {
|
||||
$this->options['per_page'] = (int) $per_page;
|
||||
|
||||
if ($current_page > 0) {
|
||||
$this->options['page'] = (int) $current_page;
|
||||
}
|
||||
|
||||
foreach ($options as $option => $value) {
|
||||
$this->options[$option] = $value;
|
||||
}
|
||||
|
||||
$data = $this->get();
|
||||
$totalResults = WooCommerce::countResults();
|
||||
$totalPages = WooCommerce::countPages();
|
||||
$currentPage = WooCommerce::current();
|
||||
$previousPage = WooCommerce::previous();
|
||||
$nextPage = WooCommerce::next();
|
||||
|
||||
$pagination = [
|
||||
'total_results' => $totalResults,
|
||||
'total_pages' => $totalPages,
|
||||
'current_page' => $currentPage,
|
||||
'previous_page' => $previousPage,
|
||||
'next_page' => $nextPage,
|
||||
'first_page' => 1,
|
||||
'last_page' => $totalResults,
|
||||
];
|
||||
|
||||
$results = [
|
||||
'meta' => $pagination,
|
||||
'data' => $data,
|
||||
];
|
||||
|
||||
if ($this->isLazyCollection) {
|
||||
return LazyCollection::make($results);
|
||||
}
|
||||
|
||||
if ($this->isCollection) {
|
||||
return collect($results);
|
||||
}
|
||||
|
||||
return $results;
|
||||
} catch (\Exception $ex) {
|
||||
throw new \Exception($ex->getMessage(), 1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Count all results.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
protected function count()
|
||||
{
|
||||
try {
|
||||
$results = WooCommerce::all($this->endpoint, $this->options);
|
||||
$totalResults = WooCommerce::countResults();
|
||||
|
||||
return $totalResults;
|
||||
} catch (\Exception $ex) {
|
||||
throw new \Exception($ex->getMessage(), 1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Store data.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function save()
|
||||
{
|
||||
$this->results = WooCommerce::create($this->endpoint, $this->properties);
|
||||
|
||||
if ($this->isLazyCollection) {
|
||||
return LazyCollection::make($this->results);
|
||||
}
|
||||
|
||||
if ($this->isCollection) {
|
||||
return collect($this->results);
|
||||
}
|
||||
|
||||
return $this->results;
|
||||
}
|
||||
}
|
||||
188
vendor/codexshaper/laravel-woocommerce/src/Traits/WooCommerceTrait.php
vendored
Normal file
188
vendor/codexshaper/laravel-woocommerce/src/Traits/WooCommerceTrait.php
vendored
Normal file
@@ -0,0 +1,188 @@
|
||||
<?php
|
||||
|
||||
namespace Codexshaper\WooCommerce\Traits;
|
||||
|
||||
trait WooCommerceTrait
|
||||
{
|
||||
/**
|
||||
* GET method.
|
||||
* Retrieve data.
|
||||
*
|
||||
* @param string $endpoint API endpoint.
|
||||
* @param array $options
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function all($endpoint = '', $options = [])
|
||||
{
|
||||
try {
|
||||
self::__construct();
|
||||
|
||||
return $this->client->get($endpoint, $options);
|
||||
} catch (\Exception $e) {
|
||||
throw new \Exception($e->getMessage(), 1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* GET method.
|
||||
* Retrieve Single data.
|
||||
*
|
||||
* @param string $endpoint API endpoint.
|
||||
* @param array $options
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function find($endpoint = '', $options = [])
|
||||
{
|
||||
try {
|
||||
self::__construct();
|
||||
|
||||
return $this->client->get($endpoint, $options);
|
||||
} catch (\Exception $e) {
|
||||
throw new \Exception($e->getMessage(), 1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* POST method.
|
||||
* Insert data.
|
||||
*
|
||||
* @param string $endpoint API endpoint.
|
||||
* @param array $data
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function create($endpoint, $data)
|
||||
{
|
||||
try {
|
||||
self::__construct();
|
||||
|
||||
return $this->client->post($endpoint, $data);
|
||||
} catch (\Exception $e) {
|
||||
throw new \Exception($e->getMessage(), 1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* PUT method.
|
||||
* Update data.
|
||||
*
|
||||
* @param string $endpoint API endpoint.
|
||||
* @param array $data
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function update($endpoint, $data)
|
||||
{
|
||||
try {
|
||||
self::__construct();
|
||||
|
||||
return $this->client->put($endpoint, $data);
|
||||
} catch (\Exception $e) {
|
||||
throw new \Exception($e->getMessage(), 1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* DELETE method.
|
||||
* Remove data.
|
||||
*
|
||||
* @param string $endpoint API endpoint.
|
||||
* @param array $options
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function delete($endpoint, $options = [])
|
||||
{
|
||||
try {
|
||||
self::__construct();
|
||||
|
||||
return $this->client->delete($endpoint, $options);
|
||||
} catch (\Exception $e) {
|
||||
throw new \Exception($e->getMessage(), 1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the last request header.
|
||||
*
|
||||
* @return \Automattic\WooCommerce\HttpClient\Request
|
||||
*/
|
||||
public function getRequest()
|
||||
{
|
||||
try {
|
||||
return $this->client->http->getRequest();
|
||||
} catch (\Exception $e) {
|
||||
throw new \Exception($e->getMessage(), 1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the http response headers from last request.
|
||||
*
|
||||
* @return \Automattic\WooCommerce\HttpClient\Response
|
||||
*/
|
||||
public function getResponse()
|
||||
{
|
||||
try {
|
||||
return $this->client->http->getResponse();
|
||||
} catch (\Exception $e) {
|
||||
throw new \Exception($e->getMessage(), 1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Count the total results and return it.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function countResults()
|
||||
{
|
||||
return (int) $this->getResponse()->getHeaders()[$this->headers['header_total']];
|
||||
}
|
||||
|
||||
/**
|
||||
* Count the total pages and return.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function countPages()
|
||||
{
|
||||
return (int) $this->getResponse()->getHeaders()[$this->headers['header_total_pages']];
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the current page number.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function current()
|
||||
{
|
||||
return !empty($this->getRequest()->getParameters()['page']) ? $this->getRequest()->getParameters()['page'] : 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the previous page number.
|
||||
*
|
||||
* @return int|null
|
||||
*/
|
||||
public function previous()
|
||||
{
|
||||
$currentPage = $this->current();
|
||||
|
||||
return ($currentPage-- > 1) ? $currentPage : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the next page number.
|
||||
*
|
||||
* @return int|null
|
||||
*/
|
||||
public function next()
|
||||
{
|
||||
$currentPage = $this->current();
|
||||
|
||||
return ($currentPage++ < $this->countPages()) ? $currentPage : null;
|
||||
}
|
||||
}
|
||||
51
vendor/codexshaper/laravel-woocommerce/src/WooCommerceApi.php
vendored
Normal file
51
vendor/codexshaper/laravel-woocommerce/src/WooCommerceApi.php
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace Codexshaper\WooCommerce;
|
||||
|
||||
use Automattic\WooCommerce\Client;
|
||||
use Codexshaper\WooCommerce\Traits\WooCommerceTrait;
|
||||
|
||||
class WooCommerceApi
|
||||
{
|
||||
use WooCommerceTrait;
|
||||
|
||||
/**
|
||||
*@var \Automattic\WooCommerce\Client
|
||||
*/
|
||||
protected $client;
|
||||
|
||||
/**
|
||||
*@var array
|
||||
*/
|
||||
protected $headers = [];
|
||||
|
||||
/**
|
||||
* Build Woocommerce connection.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
try {
|
||||
$this->headers = [
|
||||
'header_total' => config('woocommerce.header_total') ?? 'X-WP-Total',
|
||||
'header_total_pages' => config('woocommerce.header_total_pages') ?? 'X-WP-TotalPages',
|
||||
];
|
||||
|
||||
$this->client = new Client(
|
||||
config('woocommerce.store_url'),
|
||||
config('woocommerce.consumer_key'),
|
||||
config('woocommerce.consumer_secret'),
|
||||
[
|
||||
'version' => 'wc/'.config('woocommerce.api_version'),
|
||||
'wp_api' => config('woocommerce.wp_api_integration'),
|
||||
'verify_ssl' => config('woocommerce.verify_ssl'),
|
||||
'query_string_auth' => config('woocommerce.query_string_auth'),
|
||||
'timeout' => config('woocommerce.timeout'),
|
||||
]
|
||||
);
|
||||
} catch (\Exception $e) {
|
||||
throw new \Exception($e->getMessage(), 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
38
vendor/codexshaper/laravel-woocommerce/src/WooCommerceServiceProvider.php
vendored
Normal file
38
vendor/codexshaper/laravel-woocommerce/src/WooCommerceServiceProvider.php
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace Codexshaper\WooCommerce;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class WooCommerceServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Boot the service provider.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$this->publishes([
|
||||
__DIR__.'/config/woocommerce.php' => config_path('woocommerce.php'),
|
||||
], 'woocommerce');
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->mergeConfigFrom(
|
||||
__DIR__.'/config/woocommerce.php',
|
||||
'woocommerce'
|
||||
);
|
||||
|
||||
$this->app->singleton('WooCommerceApi', function () {
|
||||
return new WooCommerceApi();
|
||||
});
|
||||
$this->app->alias('Codexshaper\Woocommerce\WooCommerceApi', 'WooCommerceApi');
|
||||
}
|
||||
}
|
||||
73
vendor/codexshaper/laravel-woocommerce/src/config/woocommerce.php
vendored
Normal file
73
vendor/codexshaper/laravel-woocommerce/src/config/woocommerce.php
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
/**
|
||||
*================================================================================
|
||||
* Store URL eg: http://example.com
|
||||
*================================================================================.
|
||||
*/
|
||||
'store_url' => env('WOOCOMMERCE_STORE_URL', 'YOUR_STORE_URL'),
|
||||
|
||||
/**
|
||||
*================================================================================
|
||||
* Consumer Key
|
||||
*================================================================================.
|
||||
*/
|
||||
'consumer_key' => env('WOOCOMMERCE_CONSUMER_KEY', 'YOUR_CONSUMER_KEY'),
|
||||
|
||||
/**
|
||||
* Consumer Secret.
|
||||
*/
|
||||
'consumer_secret' => env('WOOCOMMERCE_CONSUMER_SECRET', 'YOUR_CONSUMER_SECRET'),
|
||||
|
||||
/**
|
||||
*================================================================================
|
||||
* SSL support
|
||||
*================================================================================.
|
||||
*/
|
||||
'verify_ssl' => env('WOOCOMMERCE_VERIFY_SSL', false),
|
||||
|
||||
/**
|
||||
*================================================================================
|
||||
* Woocommerce API version
|
||||
*================================================================================.
|
||||
*/
|
||||
'api_version' => env('WOOCOMMERCE_API_VERSION', 'v3'),
|
||||
|
||||
/**
|
||||
*================================================================================
|
||||
* Enable WP API Integration
|
||||
*================================================================================.
|
||||
*/
|
||||
'wp_api' => env('WP_API_INTEGRATION', true),
|
||||
|
||||
/**
|
||||
*================================================================================
|
||||
* Force Basic Authentication as query string
|
||||
*================================================================================.
|
||||
*/
|
||||
'query_string_auth' => env('WOOCOMMERCE_WP_QUERY_STRING_AUTH', false),
|
||||
|
||||
/**
|
||||
*================================================================================
|
||||
* Default WP timeout
|
||||
*================================================================================.
|
||||
*/
|
||||
'timeout' => env('WOOCOMMERCE_WP_TIMEOUT', 15),
|
||||
|
||||
/**
|
||||
*================================================================================
|
||||
* Total results header
|
||||
* Default value X-WP-Total
|
||||
*================================================================================.
|
||||
*/
|
||||
'header_total' => env('WOOCOMMERCE_WP_HEADER_TOTAL', 'X-WP-Total'),
|
||||
|
||||
/**
|
||||
*================================================================================
|
||||
* Total pages header
|
||||
* Default value X-WP-TotalPages
|
||||
*================================================================================.
|
||||
*/
|
||||
'header_total_pages' => env('WOOCOMMERCE_WP_HEADER_TOTAL_PAGES', 'X-WP-TotalPages'),
|
||||
];
|
||||
14
vendor/codexshaper/laravel-woocommerce/tests/Product.php
vendored
Normal file
14
vendor/codexshaper/laravel-woocommerce/tests/Product.php
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace CodexShaper\Dumper\Test;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class Product extends TestCase
|
||||
{
|
||||
/** @test */
|
||||
public function it_provides_a_factory_method()
|
||||
{
|
||||
$this->assertSame(true, true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user