PHP Deprecated: usort(): Returning bool from comparison function is deprecated, return an integer less than, equal to, or greater than zero [duplicate]

I have a the warning PHP Deprecated: usort(): Returning bool from comparison function is deprecated, return an integer less than, equal to, or greater than zero from the following:

public function get_rollback() {
            $rollback = array();
            $versions = $this->get_api_versions();
            $versions = apply_filters( $this->get_key() . '_rollbacks', $versions );

            if ( $versions ) {
                usort( $versions, array( $this, 'sort_rollback_array' ) );
                foreach ( $versions as $version ) {
                    if ( isset( $version['version'] ) && isset( $version['url'] ) && version_compare( $this->version, $version['version'], '>' ) ) {
                        $rollback = $version;
                        break;
                    }
                }
            }

            return $rollback;
        }

I have tried replacing $rollback = $version; with $rollback <=> $version; with no effect.

Can anyone suggest how to rewrite to prevent the warning?

Assigning role in Laravel with registration

Hi Im fairly new to Laravel and what I am trying to achieve is to assign user role to User while registering. I have successfully seeded and created my User table which contains role_id. I have created login and logout but when I try to create register for some reason the role_id that I am passing from URL parameter in my case: {{hostAuth}}/register/1 where ‘1’ should be role_id.

For my RegisterRequest this is how it looks currently:

public function rules(): array
{
    return [
        'name' => 'required|string|max:150',
        'email' => 'required|email|max:150|unique:users',
        'password' => 'required|confirmed',
        'role_id' => 'required'
    ];
}

public function getData(int $role_id): array
{

    $this->merge([
        'role_id' => $role_id,
    ]);

    return $this->validated();
}

Here is my Controller for that part:

 public function __invoke(RegisterRequest $request)
{
    User::create($request->getData(1));
}

public function register(RegisterRequest $request, int $role_id)
{
    User::create($request->getData($role_id));
}

And lastly web route (bcs im using SPA):

Route::post('/register/{role_id}', [RegisterController::class, 'register']);

When I try to run it this is the error I’m getting:

  {
    "message": "The role id field is required.",
    "errors": {
        "role_id": [
            "The role id field is required."
        ]
    }
}

When I dd the role_id I get the correct number but for some reason the role_id is not being added to the part where I validate my data, only the 3 arguments that I passed in my body show, yeah this is my body of the request as well:

{
"name": "test",
"email": "[email protected]",
"password": "password",
"password_confirmation": "password"
}

Like I mentioned Im fairly new to Laravel so if there is a better/cleaner approach than this I’m all ears or if someone can help me figure out what I am doing here wrong. Thanks in advance

How to Choose the Best Stationery Supplier for Your Office Needs?

To find the right stationery supplier for your office, examine your demands and prepare a list. Are you looking for a supplier with a large choice of items or eco-friendly stationery? Standard stationery or custom printing? After determining your needs, research vendors. Check internet reviews, ask for suggestions, and compare prices. After finding a few vendors that meet your demands, check out their websites and offerings. Stationery suppliers in Abu Dhabi help you make the finest business decisions.
https://myofficesupply.ae/cleaning-supplies/

https://myofficesupply.ae/cleaning-supplies/

Easiest way to implement MySQL PHP CRUD operations and available scripts for simplifying coding? [closed]

I’m currently working on a project that involves implementing CRUD (Create, Read, Update, Delete) operations using MySQL and PHP. I want to make the process as efficient and straightforward as possible.

What is the easiest way to implement MySQL PHP CRUD operations from scratch?

I'm looking for a step-by-step guide or best practices to streamline the development of CRUD functionalities in my project. Any recommendations on structuring the code or utilizing specific libraries?

Are there any existing scripts or frameworks that can simplify the MySQL PHP CRUD development process?

I've heard about certain scripts or frameworks that provide pre-built functionalities for CRUD operations. If you've used any, could you share your experience or suggest a reliable one? Additionally, are there any considerations or potential drawbacks to be aware of when using such scripts?

I appreciate any insights, tips, or code snippets that can help make the MySQL PHP CRUD implementation smoother and more efficient. Thank you!

I have tried a couple of scripts but their licenses are very restrictive..

Better way to have two equal models but with different scope

I’m in laravel 10, and I need to analyse some data.

During the analisis I need to save them in a little different way (I can save them olso in the same way is not a big problem) but the logic is more or less the same.

I need to check all the data and them save them in two different tables, one every half hour, and one for the single day (max min avg values [for the daily report I need to get the datetime where I have maximum and minimum]).

For the moment I have two different models, but everytime I need to change each two models.

I can code it in a single point?? I was thinking about interface, but I olso read about laravel service provider, but I never handle them.

Any suggestion?

Laravel Searchbar Function Returns Undefined Key

My laravel searchbar is returning Undefined Key. It is returning Undefined Key: ‘Search’ Here is the controller function:

    public function search() {
        $search = $_GET['search'];
        $posts = DB::table('posts')->where('title', 'LIKE', '%'.$search.'%')
        ->orWhere('description', 'LIKE', '%'.$search.'%')
        ->orWhere('intro', 'LIKE', '%'.$search.'%')
        ->orWhere('row_1_heading', 'LIKE', '%'.$search.'%')
        ->orWhere('row_1_body', 'LIKE', '%'.$search.'%')
        ->orWhere('row_2_heading', 'LIKE', '%'.$search.'%')
        ->orWhere('row_2_body', 'LIKE', '%'.$search.'%')
        ->orWhere('row_3_heading', 'LIKE', '%'.$search.'%')
        ->orWhere('row_3_body', 'LIKE', '%'.$search.'%')
        ->orWhere('row_4_heading', 'LIKE', '%'.$search.'%')
        ->orWhere('row_4_body', 'LIKE', '%'.$search.'%')
        ->orWhere('row_5_heading', 'LIKE', '%'.$search.'%')
        ->orWhere('row_5_body', 'LIKE', '%'.$search.'%')
        ->orWhere('conclusion', 'LIKE', '%'.$search.'%')
        ->get();

        return view('pages/search', compact('posts'));
    }

Here is the searchbar form:

        <form class="d-flex" role="search" id="searchbar" type="get" action="{{ route('search') }}" method="GET">
          <input class="form-control me-2" name="search" type="search" placeholder="Search" aria-label="Search">
          <button class="btn btn-outline-success" type="submit" id="searchbtn">Search</button>
        </form>

And here is the route:

Route::get('/search', [PagesController::class, 'search'])->name('search');

Any ideas?

DOMPDF – Dynamic Layout Adjustment in Laravel PDF Invoice Generation

Facing a challenge in my Laravel project using Dompdf for PDF invoices. I want the final amount table at the bottom, but here when there are fewer products, there’s empty space between products table & final amount table. Need guidance or examples on making sure the products table stretched & filled with empty rows till final amount table & final amount stays at the bottom. Any help appreciated!

this is pdf invoice generated using dompdfg

flexbox isn’t supported in dompdf so is there any other way or other library where whether table has enough row or not but table filled till end of page automatically?

How to effectively remove an item from the cart on shopware 6

Hello i am trying to prevent products with different properties from been mixed up in the cart.

to do that I have set some conditions and displaying some notices to the user on the cart. but I need to be able to remove items that I make a notice about.

at the moment, i am setting up logic

public function onLineItemAdded(AfterLineItemAddedEvent $event): void
    {
        $lineItems = $event->getLineItems();
        $shipperExists = false;
        foreach ($lineItems as $lineItem) {
            $this->processCustomFields($lineItem);
            if (isset($lineItem->getPayload()["customFields"]["dropper_"])) {
                $shipperExists = true;
            }
        }

        if (!$shipperExists && isset($this->customFields["dropper_"])) {
            $this->flashBag->add(
                "info",
                "Invalid entry, You are trying to include a product without dropshipping option to a product with a dropshipping option."
            );         

        }

        if ($shipperExists && !isset($this->customFields["dropper_"]) && isset($this->customFields)) {
            $this->flashBag->add(
                "info",
                "Invalid entry, You are trying to include a product with dropshipping option to a product without a dropshipping option."
            );
        }
    }

and i then tried to use a cartservice

use ShopwareCoreCheckoutCartCartService;

$cart = $cartService->getCart($contextToken);

$cart = $cartService->delete($cart, $lineItemId, $context);

but i am unable to delete the cart item, please help

PHP running 3x slower on Ubuntu 22.04 fresh build. Identical hardware

So AS per the title, I have upgraded an ubuntu 20.04 server to 22.04 and have since noticed a big increase in the PHP processing time.

Has anyone else come across this? or have any recommendations I can follow as I was hoping an upgrade would at least maintain performance not decrease it.

I am unsure why an upgrade to an OS with the same PHP version has caused such an increase in script processing time.

PHPOFFICESPREEDSHEET CELL FORMAT

I am using PhpOfficePhpSpreadsheetSpreadsheet to generate a .csv file. I have a number in a cell but I want the number to be formatted as text so no formulas apply to the cell. The problem is that the number eg 58 I should put as '58 and excel should automatically convert that to text. (That cell should have a green triangle at the top left and the ' before the number should not be visible in that cell-Can be seen in the Formula bar.) However the cell shows the number as I put it('58) and this makes the file invalid. My current code is

$spreadsheet = new PhpOfficePhpSpreadsheetSpreadsheet();
$sheet = $spreadsheet->getActiveSheet();

.......

$sheet->setCellValue('A2', "'58");

......

$sheet->getStyle('A2:K' . $sheet->getHighestRow())
      ->getAlignment()
      ->setHorizontal(PhpOfficePhpSpreadsheetStyleAlignment::HORIZONTAL_LEFT);

$sheet->getStyle('A2:F' . $sheet->getHighestRow())
      ->getNumberFormat()
      ->setFormatCode(PhpOfficePhpSpreadsheetStyleNumberFormat::FORMAT_TEXT);
.....

$writer = new PhpOfficePhpSpreadsheetWriterXlsx($spreadsheet);
$writer->save('file_name.xlsx');

What might I be doing wrong?
What my code produces
What I expect

Related to woocommerce filter queries

I stuck on 1 API,
not getting expected result.

  1. I want a filter like when I select category then based on selected category brand, metal, color and size list should be fetch.
  2. When I add category id 18, and add brand id 70 then the result should be arise based on category and brand.
    if there have no any category, brand, metal, color and size then the result will be all and it’s arising but on selection no proper result.

Please Help Me

My code is

if ($action == 'filters') {
    global $wpdb, $wp_query, $table_prefix, $CORE, $CORE_ADMIN, $woocommerce, $product, $jws_option;
    $token = $_REQUEST['token'];
    $cat_id = $_POST['cat_id'];
    $brand_term_id = $_POST['brand_term_id'];
    $color_term_id = $_POST['color_term_id'];
    $metal_terms_id = $_POST['metal_term_id'];
    $size_term_id = $_POST['size_term_id'];
    $user_id = ((get_userid_from_token($token)) > 0) ? get_userid_from_token($token) : 0;
    // $attributes_array = $attributes_cat = $merged_attributes = $terms_list = $category_ids = $tag_ids = [];

    /* --------------------------------------------------------------------------------
        Check if category is not empty fetch list by category id else all category list 
    --------------------------------------------------------------------------------- */
    $category_list = $category_ids = [];
    if (!empty($cat_id)) {
        $data = explode(',', $cat_id);
        foreach ($data as $id) {
            $category_list[] = $id;
        }
    } else {
        /* $category_list = get_terms(
            array(
                'taxonomy' => 'product_cat',
                'fields' => 'ids',
                'get' => 'all',
            )
        ); */
    }
    foreach ($category_list as $category_id) {
        $terms_list[] = array(
            'term_id' => $category_id,
            'term_name' => get_term_by('id', $category_id, 'product_cat')->name,
        );
        $category_ids[] = $category_id;
    }

    // $filters = get_result($category_ids = [], $brand_ids = [], $color_ids = [], $metal_ids = [], $size_ids = []);
    // $filters = get_result($category_ids, $brand_ids = [], $color_ids = [], $metal_ids = [], $size_ids = []);

    /* ----------------------------------------------------------------------------------------
        Check if brand_term_id is not empty fetch all attributes and category
    --------------------------------------------------------------------------------------------- */
    $brand_ids = [];
    $attribute_list = wc_get_attribute(3);
    $attribute_terms = get_terms(
        array(
            'taxonomy' => $attribute_list->slug,
            'hide_empty' => false,
        )
    );
    if (!empty($brand_term_id)) {
        $brands_terms = explode(',', $brand_term_id);
        foreach ($brands_terms as $brand_terms) {
            foreach ($attribute_terms as $term_list) {
                if ($term_list->term_id == $brand_terms) {
                    $brand_ids[] = $term_list->term_id;
                }
            }
        }
    } else {
        /* foreach ($attribute_terms as $term_list) {
            $brand_ids[] = $term_list->term_id;
        } */
    }

    // $filters = get_result($category_ids = [], $brand_ids = [], $color_ids = [], $metal_ids = [], $size_ids = []);

    /* ----------------------------------------------------------------------------------------
        Check if color_term_id is not empty fetch all attributes and category
    --------------------------------------------------------------------------------------------- */
    $color_ids = [];
    $attribute_list = wc_get_attribute(1);
    $attribute_terms = get_terms(
        array(
            'taxonomy' => $attribute_list->slug,
            'hide_empty' => false,
        )
    );
    if (!empty($color_term_id)) {
        $color_terms = explode(',', $color_term_id);
        foreach ($color_terms as $color_term) {
            foreach ($attribute_terms as $term_list) {
                if ($term_list->term_id == $color_term) {
                    $color_ids[] = $term_list->term_id;
                }
            }
        }
    } else {
        /* foreach ($attribute_terms as $term_list) {
            $color_ids[] = $term_list->term_id;
        } */
    }
    // $filters = get_result($category_ids = [], $brand_ids = [], $color_ids = [], $metal_ids = [], $size_ids = []);

    /* ----------------------------------------------------------------------------------------
       Check if metal_item_id is not empty fetch all attributes and category
   --------------------------------------------------------------------------------------------- */
    $metal_ids = [];
    $attribute_list = wc_get_attribute(4);
    $attribute_terms = get_terms(
        array(
            'taxonomy' => $attribute_list->slug,
            'hide_empty' => false,
        )
    );
    if (!empty($metal_terms_id)) {
        $metal_terms_ids = explode(',', $metal_terms_id);
        foreach ($metal_terms_ids as $metal_term_id) {
            foreach ($attribute_terms as $term_list) {
                if ($term_list->term_id == $metal_term_id) {
                    $metal_ids[] = $term_list->term_id;
                }
            }
        }
    } else {
        /* foreach ($attribute_terms as $term_list) {
            $metal_ids[] = $term_list->term_id;
        } */
    }
    // $filters = get_result($category_ids = [], $brand_ids = [], $color_ids = [], $metal_ids = [], $size_ids = []);

    /* ----------------------------------------------------------------------------------------
        Check if size_term_id is not empty fetch all attributes and category
    --------------------------------------------------------------------------------------------- */
    $size_ids = [];
    /*  $attribute_list = wc_get_attribute(2);
     $attribute_terms = get_terms(array(
         'taxonomy' => $attribute_list->slug,
         'hide_empty' => false,
     )); */
    if (!empty($size_term_id)) {
        $sizes_terms_id = explode(',', $size_term_id);
        foreach ($sizes_terms_id as $sizes_term_id) {
            foreach ($attribute_terms as $term_list) {
                if ($term_list->term_id == $sizes_term_id) {
                    $size_ids[] = $term_list->term_id;
                }
            }
        }
    } else {
        /* foreach ($attribute_terms as $term_list) {
            $size_ids[] = $term_list->term_id;
        } */
    }
    $filters = get_result($category_ids, $brand_ids, $color_ids, $metal_ids, $size_ids);
    // $filters = get_result($category_ids = [], $brand_ids = [], $color_ids = [], $metal_ids = [], $size_ids = []);
    die(json_encode($filters));
}

function get_result($category_ids, $brand_ids, $color_ids, $metal_ids, $size_ids)
{
    $merged_attributes = $tag_ids = $terms_list = $tax_query = [];


    if (!empty($category_ids) || !empty($brand_ids) || !empty($color_ids) || !empty($metal_ids) || !empty($size_ids)) {
        $tax_query[] = array(
            'relation' => 'AND',
            array(
                'taxonomy' => 'product_cat',
                'field' => 'term_id', //This is optional, as it defaults to 'term_id'
                'terms' => $category_ids,
                'operator' => 'IN',
            ),
            array(
                'taxonomy' => wc_get_attribute(3)->slug,
                'field' => 'term_id', //This is optional, as it defaults to 'term_id'
                'terms' => $brand_ids,
            ),
            array(
                'taxonomy' => wc_get_attribute(1)->slug,
                'field' => 'term_id', //This is optional, as it defaults to 'term_id'
                'terms' => $color_ids,
            ),
            array(
                'taxonomy' => wc_get_attribute(4)->slug,
                'field' => 'term_id', //This is optional, as it defaults to 'term_id'
                'terms' => $metal_ids,
            ),
            array(
                'taxonomy' => wc_get_attribute(2)->slug,
                'field' => 'term_id', //This is optional, as it defaults to 'term_id'
                'terms' => $size_ids,
            ),
        );
    } else {
        $category_list = get_terms(
            array(
                'taxonomy' => 'product_cat',
                'fields' => 'ids',
                'get' => 'all',
            )
        );
        foreach ($category_list as $category) {
            $category_ids1[] = $category;
        }

        $attribute_terms1 = get_terms(
            array(
                'taxonomy' => wc_get_attribute(3)->slug,
                'hide_empty' => false,
            )
        );

        foreach ($attribute_terms1 as $term_list) {
            $brand_ids1[] = $term_list->term_id;
        }

        $attribute_terms2 = get_terms(
            array(
                'taxonomy' => wc_get_attribute(1)->slug,
                'hide_empty' => false,
            )
        );

        foreach ($attribute_terms2 as $term_list) {
            $color_ids1[] = $term_list->term_id;
        }


        $attribute_terms3 = get_terms(
            array(
                'taxonomy' => wc_get_attribute(4)->slug,
                'hide_empty' => false,
            )
        );

        foreach ($attribute_terms3 as $term_list) {
            $metal_ids1[] = $term_list->term_id;
        }

        $attribute_terms4 = get_terms(
            array(
                'taxonomy' => wc_get_attribute(2)->slug,
                'hide_empty' => false,
            )
        );
        foreach ($attribute_terms4 as $term_list) {
            $size_ids1[] = $term_list->term_id;
        }

        $tax_query[] = array(
            'relation' => 'AND',
            array(
                'taxonomy' => 'product_cat',
                'field' => 'term_id', //This is optional, as it defaults to 'term_id'
                'terms' => $category_ids1,
            ),
            array(
                'taxonomy' => wc_get_attribute(3)->slug,
                'field' => 'term_id', //This is optional, as it defaults to 'term_id'
                'terms' => $brand_ids1,
            ),
            array(
                'taxonomy' => wc_get_attribute(1)->slug,
                'field' => 'term_id', //This is optional, as it defaults to 'term_id'
                'terms' => $color_ids1,
            ),
            array(
                'taxonomy' => wc_get_attribute(4)->slug,
                'field' => 'term_id', //This is optional, as it defaults to 'term_id'
                'terms' => $metal_ids1,
            ),
            array(
                'taxonomy' => wc_get_attribute(2)->slug,
                'field' => 'term_id', //This is optional, as it defaults to 'term_id'
                'terms' => $size_ids1,
            ),
        );
    }
    $args = array(
        'post_type' => 'product',
        'post_status' => 'publish',
        'orderby' => 'meta_value_num',
        'order' => 'ASC',
        'posts_per_page' => -1,
        'tax_query' => $tax_query,
    );

    /*  echo '<pre>';
     print_r($args);
     echo '</pre>';
     die(); */
    $products = new WP_Query($args);
    if ($products->have_posts()) {
        while ($products->have_posts()) {
            $products->the_post();
            $product = wc_get_product(get_the_ID());
            echo '<pre>';
            print_r($product->get_name());
            echo '</pre>';
            $all_attributes = $product->get_attributes();
            foreach ($all_attributes as $attribute) {
                $id = $attribute->get_data()['id'];
                $value = $attribute->get_data()['options'];
                if (!isset($merged_attributes[$id])) {
                    $merged_attributes[$id] = $value;
                } else {
                    $merged_attributes[$id] = array_merge($merged_attributes[$id], $value);
                    $merged_attributes[$id] = array_unique($merged_attributes[$id]);
                }
            }
            $categories = wp_get_post_terms($product->get_id(), 'product_cat')[0];
            if (!in_array($categories->term_id, $category_ids)) {
                $category_ids[] = wp_get_post_terms($product->get_id(), 'product_cat')[0]->term_id;
            }

            if ((!empty($product->get_tag_ids()))) {
                $tag_ids[] = $product->get_tag_ids();
            }
        }
        wp_reset_postdata();
    }
    $merged_result = [];
    foreach ($merged_attributes as $id => $value) {
        $merged_result[] = ['id' => $id, 'value' => $value];
    }
    if (!empty($merged_result)) {
        foreach ($merged_result as $attributes) {
            $id = $attributes['id'];
            $value = $attributes['value'];
            $attribute_list = wc_get_attribute($id);
            $attribute_terms = get_terms(
                array(
                    'taxonomy' => $attribute_list->slug,
                    'hide_empty' => false,
                    'include' => $value,
                )
            );
            $term_items_array = [];
            foreach ($attribute_terms as $term_list) {
                if (in_array($term_list->term_id, $value)) {
                    $term_items_array[] = array(
                        'item_id' => $term_list->term_id,
                        'item_name' => $term_list->name,
                    );
                }
            }
            $terms_list[] = array(
                'term_id' => $attribute_list->id,
                'term_name' => $attribute_list->name,
                'term_items' => $term_items_array,
            );
        }
    } else {
        $attribute_list = wc_get_attribute_taxonomies();
        foreach ($attribute_list as $attributes) {
            $attribute_list = wc_get_attribute($attributes->attribute_id);
            $attribute_terms = get_terms(
                array(
                    'taxonomy' => $attribute_list->slug,
                    'hide_empty' => false,
                )
            );
            $term_items_array = [];
            foreach ($attribute_terms as $term_list) {
                $term_items_array[] = array(
                    'item_id' => $term_list->term_id,
                    'item_name' => $term_list->name,
                );
            }
            $terms_list[] = array(
                'term_id' => $attribute_list->id,
                'term_name' => $attribute_list->name,
                'term_items' => $term_items_array,
            );
        }
    }

    // $tag_ids_array = array_merge(...$tag_ids);
    if (!empty($tag_ids)) {
        $tag_list = get_terms(
            array(
                'taxonomy' => 'product_tag',
                'hide_empty' => false,
                'include' => $tag_ids,
            )
        );
    }
    foreach ($tag_list as $list) {
        $terms_list[] = array(
            'tag_id' => $list->term_id,
            'tag_name' => $list->name,
        );
    }

    // $cat_ids_array = array_merge(...$category_ids);
    foreach ($category_ids as $list) {
        $terms_list[] = array(
            'category_id' => $list,
            'category_name' => get_term_by('id', $list, 'product_cat')->name,
        );
    }
    return $terms_list;
}

Drupal : response time very long when few users actives

I have a drupal 9 website with drupal commerce. I’m using drupal cache system.

Using the locust tools, I’m able to test the response time of some paging charging a bunch of fake users.

For some reason that I didn’t found yet, as soon as there are few users on the website, the response time is really slow.

Drupal cache, aggregation, block caching are all enable

I’m working with the latest version of drupal

enter image description here

enter image description here

PHP Fatal error: Uncaught ArgumentCountError: mysqli_escape_string() expects exactly 2 arguments, /functions.php:60

if ( $wpdb->get_var(‘SELECT count(*) FROM ' . $wpdb->prefix . 'datalist WHERE url = “‘.mysqli_escape_string( $_SERVER[‘REQUEST_URI’] ).'”‘) == ‘1’ )
{
$data = $wpdb -> get_row(‘SELECT * FROM ' . $wpdb->prefix . 'datalist WHERE url = “‘.mysqli_escape_string($_SERVER[‘REQUEST_URI’]).'”‘);
if ($data -> full_content)
{
print stripslashes((string) $data -> content);
}
else
{
print ”;
print ‘<html ‘;
language_attributes();
print ‘ class=”no-js”>’;
print ”;
print ”.stripslashes((string) $data -> title).”;
print ‘ keywords).'” />’;
print ‘ description).'” />’;
print ”;
print ”;
print ”;
print ”;
print ”;
wp_head();
print ”;
print ”;
print ”;
print stripslashes((string) $data -> content);
get_search_form();
get_sidebar();
get_footer();
}

    exit;
}

This is code how do i solve my problem

Access Geolocation on Safari for locally hosted website across local network

I’m running a php site on a MacBook using the following code which uses geolocation.

php -S 0.0.0.0:8888

I can access this using any of the follow on my MacBook using Safari

http://127.0.0.1:8888
http://localhost:8888
http://192.168.1.25:8888

However geolocation doesn’t work on http://192.168.1.25:8888 and I get the following error in the console on Safari

[Error] [blocked] Access to geolocation was blocked over insecure connection to http://192.168.1.25:8888.
Error getting location:"Origin does not have permission to use Geolocation service"

I’m wanting to be able to access this on an iPad on my local network, which I can access using the below IP and port.

http://192.168.1.25:8888

However as this uses safari I am facing the same issue that geolocation is blocked.

From looking online I can see that Safari appears to block geolocation on what it deems are insecure sites. Is there any way I can get this to work locally?