加纳/运输

伊朗运输

v2.2.0 2022-08-13 08:52 UTC

README

计算伊朗邮费

安装

进入项目根目录,并运行以下命令

composer require ghaninia/shipping

如果您想确保系统正确,运行测试🐱‍🚀

vendor\bin\phpunit 

✔如果您在Laravel中使用此包,应该在app.php中添加以下命令

### config/app.php
<?php
    ....
    'providers' => [
        ...
        GhaniniaIR\Shipping\ShippingServiceProvider::class, ### ✔
    ],

接收城市和省份及其详细信息

<?php 

use GhaniniaIR\Shipping\Core\Services\LocationService ;

### Get information on cities and provinces
(new LocationService())->list();

### Are the provinces adjacent to each other?
(new LocationService())
    ->source(State $state , City $city)
    ->destination(State $state , ?City $city)
    ->provincesNeighbors() ;

### Status of origin and destination together
(new LocationService())
    ->source(State $state , City $city)
    ->destination(State $state , ?City $city)
    ->situationStatesTogether() ; 

计算邮政 Pishtaz 费率

<?php

use GhaniniaIR\Shipping\Drivers\PishtazDriver;
use GhaniniaIR\Shipping\Models\State ;
use GhaniniaIR\Shipping\Models\City ;

$result = (new PishtazDriver())
    ->weight(int $productWeight)
    ->cost(int $productCost)
    ->source(State $sourceState , City $sourceCity)
    ->destination(State $sourceState , ?City $sourceCity)
    ->calculate();

计算邮政 Sefareshi 费率

<?php

use GhaniniaIR\Shipping\Drivers\SefarshiDriver;
use GhaniniaIR\Shipping\Models\State ;
use GhaniniaIR\Shipping\Models\City ;

$result = (new SefarshiDriver())
    ->weight(int $productWeight)
    ->cost(int $productCost)
    ->source(State $sourceState , City $sourceCity)
    ->destination(State $sourceState , ?City $sourceCity)
    ->calculate();

重新连接

如果您想更改数据库连接类型,请按照以下代码操作

Laravel
php artisan vendor:publish --tag=shipping --force

然后它将发布到您的数据库和配置文件中