1 year ago

#274708

test-img

Madriesen

Laravel 9 Inertia pagination use correct base url with port

I'm using Laravel 9 with Inertia and VueJs. I'm trying to paginate my invoices, and the links display as expected when I load the page (http://localhost:3000). However, when I click on a button to go to the next page (or any other page from the pagination), all the links change to:http://localhost/. I don't know how to solve this.

InvoiceController

$invoices = Invoice::latest()
    ->with('customer:id,name')
    ->orderByDesc('invoice_date')
    ->paginate(10);

return Inertia::render('Invoices', ["invoices" => $invoices]);

.env

APP_URL=http://localhost:3000
DEV_URL=http://localhost:3000

webpack.mix.js

// ...
.browserSync("localhost");

config/app.php

'url' => env('APP_URL', 'http://localhost:3000'),

Update

A github issue is opened: https://github.com/inertiajs/inertia/issues/811

laravel

webpack

pagination

browser-sync

inertiajs

0 Answers

Your Answer

Accepted video resources