Skip to content

Commit 6e092c3

Browse files
author
Tony Lea
committed
Upgrading to Inertia 2 and Tailwind v4
1 parent c9ca6ea commit 6e092c3

File tree

15 files changed

+1924
-1250
lines changed

15 files changed

+1924
-1250
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
3+
namespace App\Http\Middleware;
4+
5+
use Illuminate\Http\Request;
6+
use Inertia\Middleware;
7+
8+
class HandleInertiaRequests extends Middleware
9+
{
10+
/**
11+
* The root template that's loaded on the first page visit.
12+
*
13+
* @see https://inertiajs.com/server-side-setup#root-template
14+
*
15+
* @var string
16+
*/
17+
protected $rootView = 'app';
18+
19+
/**
20+
* Determines the current asset version.
21+
*
22+
* @see https://inertiajs.com/asset-versioning
23+
*/
24+
public function version(Request $request): ?string
25+
{
26+
return parent::version($request);
27+
}
28+
29+
/**
30+
* Define the props that are shared by default.
31+
*
32+
* @see https://inertiajs.com/shared-data
33+
*
34+
* @return array<string, mixed>
35+
*/
36+
public function share(Request $request): array
37+
{
38+
return array_merge(parent::share($request), [
39+
//
40+
]);
41+
}
42+
}

bootstrap/app.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
<?php
22

3+
use App\Http\Middleware\HandleInertiaRequests;
34
use Illuminate\Foundation\Application;
45
use Illuminate\Foundation\Configuration\Exceptions;
56
use Illuminate\Foundation\Configuration\Middleware;
7+
use Illuminate\Http\Middleware\AddLinkHeadersForPreloadedAssets;
68

79
return Application::configure(basePath: dirname(__DIR__))
810
->withRouting(
@@ -11,7 +13,10 @@
1113
health: '/up',
1214
)
1315
->withMiddleware(function (Middleware $middleware) {
14-
//
16+
$middleware->web(append: [
17+
AddLinkHeadersForPreloadedAssets::class,
18+
HandleInertiaRequests::class,
19+
]);
1520
})
1621
->withExceptions(function (Exceptions $exceptions) {
1722
//

composer.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010
"license": "MIT",
1111
"require": {
1212
"php": "^8.2",
13+
"inertiajs/inertia-laravel": "2.x-dev",
1314
"laravel/framework": "^11.31",
14-
"laravel/tinker": "^2.9"
15+
"laravel/tinker": "^2.9",
16+
"tightenco/ziggy": "^2.4"
1517
},
1618
"require-dev": {
1719
"fakerphp/faker": "^1.23",
@@ -72,4 +74,4 @@
7274
},
7375
"minimum-stability": "stable",
7476
"prefer-stable": true
75-
}
77+
}

composer.lock

Lines changed: 148 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)