code-orange/turbolinks-location

Laravel middleware to insert Turbolinks-Location header into every response

v1.3 2020-04-06 08:01 UTC

This package is auto-updated.

Last update: 2024-04-06 17:16:32 UTC


README

This package contains a Laravel middleware for working with Turbolinks. It sets the Turbolinks-Location header on every response served, so that Turbolinks always shows the correct URL after redirects.

Installation

composer require code-orange/turbolinks-location

Usage

In your App\Http\Kernel, add the middleware to your web group:

use CodeOrange\TurbolinksLocation\TurbolinksLocation;

class Kernel extends HttpKernel {
    protected $middlewareGroups = [
        'web' => [
            ...,
            TurbolinksLocation::class
        ],
    ];
}

That's it! All requests to routes in your web.php route file will now be served with a correct Turbolinks-Location header.