| 1 |
<?php if ( ! defined( 'ABSPATH' ) ) exit; ?> |
| 2 |
<?php |
| 3 |
/** |
| 4 |
* @var $router Router |
| 5 |
*/ |
| 6 |
use FluentCart\App\Modules\Shipping\Http\Controllers\ShippingZoneController; |
| 7 |
use FluentCart\App\Modules\Shipping\Http\Controllers\ShippingClassController; |
| 8 |
use FluentCart\App\Modules\Shipping\Http\Controllers\ShippingMethodController; |
| 9 |
use FluentCart\Framework\Http\Router; |
| 10 |
|
| 11 |
$router->prefix('shipping')->withPolicy('StoreSensitivePolicy')->group(function (Router $router) { |
| 12 |
$router->get('/zones', [ShippingZoneController::class, 'index']); |
| 13 |
$router->post('/zones', [ShippingZoneController::class, 'store']); |
| 14 |
$router->get('/zones/{id}', [ShippingZoneController::class, 'show']); |
| 15 |
$router->put('/zones/{id}', [ShippingZoneController::class, 'update']); |
| 16 |
$router->delete('/zones/{id}', [ShippingZoneController::class, 'destroy']); |
| 17 |
$router->post('/zones/update-order', [ShippingZoneController::class, 'updateOrder']); |
| 18 |
|
| 19 |
$router->get('/zone/states', [ShippingZoneController::class, 'getZoneStates']); |
| 20 |
$router->get('/zone/countries', [ShippingZoneController::class, 'getCountriesByContinent']); |
| 21 |
|
| 22 |
// Methods |
| 23 |
$router->post('/methods', [ShippingMethodController::class, 'store']); |
| 24 |
$router->put('/methods', [ShippingMethodController::class, 'update']); |
| 25 |
$router->delete('/methods/{method_id}', [ShippingMethodController::class, 'destroy']); |
| 26 |
|
| 27 |
// Shipping Classes |
| 28 |
$router->get('/classes', [ShippingClassController::class, 'index']); |
| 29 |
$router->post('/classes', [ShippingClassController::class, 'store']); |
| 30 |
$router->get('/classes/{id}', [ShippingClassController::class, 'show']); |
| 31 |
$router->put('/classes/{id}', [ShippingClassController::class, 'update']); |
| 32 |
$router->delete('/classes/{id}', [ShippingClassController::class, 'destroy']); |
| 33 |
$router->get('/classes/{id}/profile', [ShippingClassController::class, 'getProfile']); |
| 34 |
|
| 35 |
// Packages (stored in fct_meta, not a DB table) |
| 36 |
$router->get('/packages', [ShippingClassController::class, 'getPackages']); |
| 37 |
$router->post('/packages', [ShippingClassController::class, 'savePackages']); |
| 38 |
}); |
| 39 |
|