MOON
Server: Apache
System: Linux server.royaltuning.hu 4.18.0-425.13.1.el8_7.x86_64 #1 SMP Tue Feb 21 04:20:52 EST 2023 x86_64
User: royaltuning (1001)
PHP: 8.2.32
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //var/www/html/Modules/Shipping/Providers/ShippingServiceProvider.php
<?php

namespace Modules\Shipping\Providers;

use Modules\Shipping\Method;
use Illuminate\Support\ServiceProvider;
use Modules\Shipping\Facades\ShippingMethod;

class ShippingServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap the application services.
     *
     * @return void
     */
    public function boot()
    {
        if (!config('app.installed')) {
            return;
        }

        $this->registerFreeShipping();
        $this->registerLocalPickup();
        $this->registerFlatRate();
        $this->registerDpdRate();
        $this->registerMplRate();
        $this->registerGlsCsomagpont();
        $this->registerFoxpostCsomagpont();
        $this->registerPacketaCsomagpont();
    }

    private function registerFreeShipping()
    {
        if (!setting('free_shipping_enabled')) {
            return;
        }

        ShippingMethod::register('free_shipping', function () {
            return new Method('free_shipping', setting('free_shipping_label'), 0);
        });
    }

    private function registerLocalPickup()
    {
        if (!setting('local_pickup_enabled')) {
            return;
        }

        ShippingMethod::register('local_pickup', function () {
            return new Method('local_pickup', setting('local_pickup_label'), setting('local_pickup_cost'));
        });
    }

    private function registerFlatRate()
    {
        if (!setting('flat_rate_enabled')) {
            return;
        }

        ShippingMethod::register('flat_rate', function () {
            return new Method('flat_rate', setting('flat_rate_label'), setting('flat_rate_cost'));
        });
    }

    private function registerDpdRate()
    {
        if (!setting('dpd_rate_enabled')) {
            return;
        }

        ShippingMethod::register('dpd_rate', function () {
            return new Method('dpd_rate', setting('dpd_rate_label'), setting('dpd_rate_cost'));
        });
    }

    private function registerMplRate()
    {
        if (!setting('mpl_rate_enabled')) {
            return;
        }

        ShippingMethod::register('mpl_rate', function () {
            return new Method('mpl_rate', setting('mpl_rate_label'), setting('mpl_rate_cost'));
        });
    }

    private function registerGlsCsomagpont()
    {
        if (!setting('gls_csomagpont_enabled')) {
            return;
        }

        ShippingMethod::register('gls_csomagpont', function () {
            return new Method('gls_csomagpont', setting('gls_csomagpont_label'), setting('gls_csomagpont_cost'));
        });
    }

    private function registerFoxpostCsomagpont()
    {
        if (!setting('foxpost_csomagpont_enabled')) {
            return;
        }

        ShippingMethod::register('foxpost_csomagpont', function () {
            return new Method('foxpost_csomagpont', setting('foxpost_csomagpont_label'), setting('foxpost_csomagpont_cost'));
        });
    }

    private function registerPacketaCsomagpont()
    {
        if (!setting('packeta_csomagpont_enabled')) {
            return;
        }

        ShippingMethod::register('packeta_csomagpont', function () {
            return new Method('packeta_csomagpont', setting('packeta_csomagpont_label'), setting('packeta_csomagpont_cost'));
        });
    }
}