bazar icon indicating copy to clipboard operation
bazar copied to clipboard

only http links in MenuRepository

Open webspilka opened this issue 4 years ago • 0 comments

  • Bazar Version: 0.9.1
  • Laravel Version: 8.5.24
  • PHP Version: 8.1.3
  • Database Driver & Version: 10.8.2-MariaDB

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

webspilka avatar Mar 14 '22 12:03 webspilka