28 lines
796 B
PHP
28 lines
796 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Api\V1\Order;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\Ecommerce\Product\Order\Shipping\OrderShippingMethod;
|
|
use Illuminate\Http\JsonResponse;
|
|
|
|
class OrderShippingMethodController extends Controller
|
|
{
|
|
/**
|
|
* Order shipping methods
|
|
*/
|
|
public function index(): JsonResponse
|
|
{
|
|
return response()->rest(
|
|
OrderShippingMethod::query()->where('is_active', true)
|
|
->get(['id', 'name', 'slug', 'price'])
|
|
->map(fn ($shippingMethod) => [
|
|
'id' => $shippingMethod->id,
|
|
'name' => $shippingMethod->name,
|
|
'slug' => $shippingMethod->slug,
|
|
'price' => $shippingMethod->price,
|
|
])
|
|
);
|
|
}
|
|
}
|