1. Go to this page and download the library: Download vanthao03596/laravel-ghtk library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use Vanthao03596\LaravelGhtk\Facades\Ghtk;
// you can alias this in config/app.php if you like
Ghtk::shipment()
->calculateFee([
'pick_province' => 'Hà Nội',
'pick_district' => 'Quận Hai Bà Trưng',
'province' => 'Hà nội',
'district' => 'Quận Cầu Giấy',
'address' => 'P.503 tòa nhà Auu Việt, số 1 Lê Đức Thọ',
'weight' => 1000,
'value' => 3000000,
'transport' => 'fly',
'deliver_option' => 'xteam',
'tags' => [1]
]);
// we're done here - how easy was that, it just works!
Ghtk::order()->createOrder([
'products' => [
[
'name' => 'bút',
'weight' => 0.1,
'quantity' => 1,
'product_code' => '23304A3MHLMVMXX625'
],
[
'name' => 'tẩy',
'weight' => 0.2,
'quantity' => 1,
'product_code' => ''
]
],
'order' => [
'id' => 'a9',
'pick_name' => 'HCM-nội thành',
'pick_address' => '590 CMT8 P.11',
'pick_province' => 'TP. Hồ Chí Minh',
'pick_district' => 'Quận 3',
'pick_ward' => 'Phường 1',
'pick_tel' => '0911222333',
'tel' => '0911222333',
'name' => 'GHTK - HCM - Noi Thanh',
'address' => '123 nguyễn chí thanh',
'province' => 'TP. Hồ Chí Minh',
'district' => 'Quận 1',
'ward' => 'Phường Bến Nghé',
'hamlet' => 'Khác',
'is_freeship' => 1,
'pick_date' => '2016-09-30',
'pick_money' => 47000,
'note' => 'Khối lượng tính cước tối đa: 1.00 kg',
'value' => 3000000,
'transport' => 'fly',
'pick_option' =>'cod',
'deliver_option' => 'xteam',
'pick_session' => '2',
'tags' => [ 1],
'email' => '[email protected]',
'use_return_address' => 1
]
]);
// this example is simple, and there are far more methods available
use Vanthao03596\LaravelGhtk\Facades\Ghtk;
// select the your_connection_name connection, then get going
Ghtk::connection('your_connection_name')shipment()
->calculateFee([
'pick_province' => 'Hà Nội',
'pick_district' => 'Quận Hai Bà Trưng',
'province' => 'Hà nội',
'district' => 'Quận Cầu Giấy',
'address' => 'P.503 tòa nhà Auu Việt, số 1 Lê Đức Thọ',
'weight' => 1000,
'value' => 3000000,
'transport' => 'fly',
'deliver_option' => 'xteam',
'tags' => [1]
]);
use Vanthao03596\LaravelGhtk\Facades\Ghtk;
// writing this:
Ghtk::connection('main')->order()->checkStatus('S1.A1.17373471');
// is identical to writing this:
Ghtk::order()->checkStatus('S1.A1.17373471');
// and is also identical to writing this:
Ghtk::connection()->order()->checkStatus('S1.A1.17373471');
// this is because the main connection is configured to be the default
Ghtk::getDefaultConnection(); // this will return main
// we can change the default connection
Ghtk::setDefaultConnection('alternative'); // the default is now alternative
use Vanthao03596\LaravelGhtk\GhtkManager;
use Illuminate\Support\Facades\App; // you probably have this aliased already
class Foo
{
protected $ghtk;
public function __construct(GhtkManager $ghtk)
{
$this->ghtk = $ghtk;
}
public function bar()
{
$this->ghtk->order()->checkStatus('S1.A1.17373471');
}
}
App::make('Foo')->bar();
bash
$ php artisan vendor:publish
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.