HEX
Server: nginx/1.28.1
System: Linux 10-41-63-61 6.8.0-31-generic #31-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 20 00:40:06 UTC 2024 x86_64
User: www (1001)
PHP: 7.4.33
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: /www/wwwroot/www.shooperm.com/Modules/Shipping/Http/Controllers/API/ShippingMethodController.php
<?php

namespace Modules\Shipping\Http\Controllers\API;

use Illuminate\Contracts\Support\Renderable;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
use Modules\Shipping\Services\ShippingService;

/**
* @group Shipping Methods
*
* APIs for shipping methods
*/
class ShippingMethodController extends Controller
{

    protected $shippingService;

    public function __construct(ShippingService $shippingService)
    {
        $this->shippingService = $shippingService;
    }

    /**
     * Shipping List
     * @response{
     *      "shippings": [
     *           {
     *               "id": 1,
     *               "method_name": "Email Delivery (within 24 Hours)",
     *               "logo": null,
     *               "phone": "25656895655",
     *               "shipment_time": "12-24 hrs",
     *               "cost": 0,
     *               "is_active": 1,
     *               "request_by_user": null,
     *               "is_approved": 1,
     *               "created_at": null,
     *               "updated_at": "2021-08-08T04:05:13.000000Z"
     *           },
     *           {
     *               "id": 2,
     *               "method_name": "Flat Rate",
     *               "logo": null,
     *               "phone": "5466523263565",
     *               "shipment_time": "3-5 days",
     *               "cost": 20,
     *               "is_active": 1,
     *               "request_by_user": null,
     *               "is_approved": 1,
     *               "created_at": null,
     *               "updated_at": "2021-08-08T04:05:46.000000Z"
     *           },
     *           {
     *               "id": 3,
     *               "method_name": "Free Shipping",
     *               "logo": null,
     *               "phone": "56563565656",
     *               "shipment_time": "8-12 days",
     *               "cost": 0,
     *               "is_active": 1,
     *               "request_by_user": null,
     *               "is_approved": 1,
     *               "created_at": "2021-08-08T04:18:37.000000Z",
     *               "updated_at": "2021-08-08T04:18:37.000000Z"
     *           }
     *       ],
     *       "msg": "success"
     * 
     * }
     */

    public function index(){
        $shippings = $this->shippingService->getActiveAllForAPI();
        if(count($shippings) > 0){
            return response()->json([
                'shippings' => $shippings,
                'msg' => 'success'
            ]);
        }else{
            return response()->json([
                'msg' => 'empty list'
            ]);
        }
    }
}