conedevelopment / bazar

Bazar is an e-commerce package for Laravel applications.
https://root.conedevelopment.com
MIT License
421 stars 56 forks source link

only http links in MenuRepository #198

Closed webspilka closed 1 year ago

webspilka commented 2 years ago

Description:

in src/vendor/conedevelopment/bazar/resources/views/app.blade.php menu: @json($menu) return only http links, my site works on https

Now I fix it by change function register in src/vendor/conedevelopment/bazar/src/Repositories/MenuRepository.php

// src/vendor/conedevelopment/bazar/src/Repositories/MenuRepository.php
public function register(string $route, string $label, array $options = ["items" => []]): void
    {
        $options = array_replace_recursive([
            'items' => [],
            'label' => $label,
            'group' => __('Shop'),
            'icon' => 'dashboard',
        ], $options);

        $route = str_replace( 'http://', 'https://', $route );
        // array(2) { ["items"]=> array(2) { ["http://bazar.com.lh/bazar/orders"]=> string(10) "All Orders" ["http://bazar.com.lh/bazar/orders/create"]=> string(12) "Create Order" } ["icon"]=> string(5) "order" }
        // convert to
        // array(2) { ["items"]=> array(2) { ["https://bazar.com.lh/bazar/orders"]=> string(10) "All Orders" ["https://bazar.com.lh/bazar/orders/create"]=> string(12) "Create Order" } ["icon"]=> string(5) "order" }
        if (array_key_exists('items', $options)) {
            foreach ($options["items"] as $key => $option) {
                $oldkey = $key;
                $newkey = str_replace( 'http://', 'https://', $key );
                $options["items"][$newkey] = $options["items"][$oldkey];
                unset($options["items"][$oldkey]);
            }
        }
        // dd($options);
        $this->items->put($route, $options);
    }

Steps To Reproduce:

just install project