Primo Committ
This commit is contained in:
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';
|
||||
}
|
||||
Reference in New Issue
Block a user