# fluent-cart/1.6.4/app/Modules/Shipping/Http/Controllers/ShippingMethodController.php

FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler, version 1.6.4. 49 lines.

- Page: https://pluginprobe.com/plugins/fluent-cart/1.6.4/code/app/Modules/Shipping/Http/Controllers/ShippingMethodController.php
- Raw: https://pluginprobe.com/plugins/fluent-cart/1.6.4/raw/app/Modules/Shipping/Http/Controllers/ShippingMethodController.php
- Modified: 2025-10-14T16:36:46+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/fluent-cart/1.6.4/code/app/Modules/Shipping/Http/Controllers/ShippingMethodController.php#L10-L20`.

```php
<?php

namespace FluentCart\App\Modules\Shipping\Http\Controllers;

use FluentCart\App\Http\Controllers\Controller;
use FluentCart\App\Models\ShippingMethod;
use FluentCart\Framework\Support\Arr;
use FluentCart\App\Modules\Shipping\Http\Requests\ShippingMethodRequest;

class ShippingMethodController extends Controller
{

    public function store(ShippingMethodRequest $request): \WP_REST_Response
    {
        $data = $request->getSafe($request->sanitize());

        ShippingMethod::create($data);

        return $this->sendSuccess([
            'message' => __('Shipping method has been created successfully', 'fluent-cart')
        ]);
    }

    public function update(ShippingMethodRequest $request): \WP_REST_Response
    {
        $data = $request->getSafe($request->sanitize());
        $methodId = Arr::get($data, 'method_id');

        $method = ShippingMethod::findOrFail($methodId);

        $method->update($data);

        return $this->sendSuccess([
            'message' => __('Shipping method has been updated successfully', 'fluent-cart')
        ]);
    }

    public function destroy($method_id)
    {
        $method = ShippingMethod::findOrFail($method_id);
        $method->delete();

        return $this->sendSuccess([
            'message' => __('Shipping method has been deleted successfully', 'fluent-cart')
        ]);
    }

}

```
