Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions app/Http/Controllers/AppController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

namespace App\Http\Controllers;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Inertia\Inertia;

class AppController extends Controller
{
public function index( Request $request )
{
return Inertia::render('Index', [

]);
}
}
43 changes: 43 additions & 0 deletions app/Http/Middleware/HandleInertiaRequests.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php

namespace App\Http\Middleware;

use Illuminate\Http\Request;
use Inertia\Middleware;

class HandleInertiaRequests extends Middleware
{
/**
* The root template that's loaded on the first page visit.
*
* @see https://inertiajs.com/server-side-setup#root-template
*
* @var string
*/
protected $rootView = 'app';

/**
* Determines the current asset version.
*
* @see https://inertiajs.com/asset-versioning
*/
public function version(Request $request): ?string
{
return parent::version($request);
}

/**
* Define the props that are shared by default.
*
* @see https://inertiajs.com/shared-data
*
* @return array<string, mixed>
*/
public function share(Request $request): array
{
return [
...parent::share($request),
//
];
}
}
5 changes: 4 additions & 1 deletion bootstrap/app.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php

use App\Http\Middleware\HandleInertiaRequests;
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;
Expand All @@ -11,7 +12,9 @@
health: '/up',
)
->withMiddleware(function (Middleware $middleware): void {
//
$middleware->web(append: [
HandleInertiaRequests::class,
]);
})
->withExceptions(function (Exceptions $exceptions): void {
//
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"license": "MIT",
"require": {
"php": "^8.2",
"inertiajs/inertia-laravel": "^2.0",
"laravel/framework": "^12.0",
"laravel/tinker": "^2.10.1",
"serversideup/cfspeedtest": "^2025.09",
Expand Down
72 changes: 71 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,11 @@
"laravel-vite-plugin": "^2.0.0",
"tailwindcss": "^4.0.0",
"vite": "^7.0.4"
},
"dependencies": {
"@inertiajs/vue3": "^2.1.7",
"@vitejs/plugin-vue": "^6.0.1",
"@vueuse/core": "^13.9.0",
"vue": "^3.5.21"
}
}
6 changes: 1 addition & 5 deletions resources/css/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,4 @@
@source '../../storage/framework/views/*.php';
@source '../**/*.blade.php';
@source '../**/*.js';

@theme {
--font-sans: 'Instrument Sans', ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
'Segoe UI Symbol', 'Noto Color Emoji';
}
@source '../**/*.vue';
9 changes: 9 additions & 0 deletions resources/js/Pages/Index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<template>
<h1 class="text-2xl font-bold">Here</h1>
</template>

<script setup>
import { ref } from 'vue'

const count = ref(0)
</script>
17 changes: 17 additions & 0 deletions resources/js/app.js
Original file line number Diff line number Diff line change
@@ -1 +1,18 @@
import './bootstrap';

import { createApp, h } from 'vue'
import { createInertiaApp } from '@inertiajs/vue3'
import { resolvePage } from './resolvePage';
const appName = import.meta.env.VITE_APP_NAME || 'Laravel';

createInertiaApp({
title: (title) => `${title} - ${appName}`,
resolve: name => {
return resolvePage(name)
},
setup({ el, App, props, plugin }) {
createApp({ render: () => h(App, props) })
.use(plugin)
.mount(el)
},
})
13 changes: 13 additions & 0 deletions resources/js/resolvePage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export function resolvePage(name) {
const pagePath = `./Pages/${name}.vue`;

const pages = import.meta.glob('./Pages/**/*.vue');

if( !pages[pagePath] ) {
throw new Error(`Page not found: ${pagePath}`);
}

return typeof pages[pagePath] === 'function'
? pages[pagePath]()
: pages[pagePath];
}
17 changes: 17 additions & 0 deletions resources/views/app.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title inertia>{{ config('app.name', 'Laravel') }}</title>

@vite('resources/js/app.js')
@vite('resources/css/app.css')

@inertiaHead
</head>

<body class="font-sans antialiased">
@inertia
</body>
</html>
277 changes: 0 additions & 277 deletions resources/views/welcome.blade.php

This file was deleted.

6 changes: 3 additions & 3 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

use Illuminate\Support\Facades\Route;

Route::get('/', function () {
return view('welcome');
});
use App\Http\Controllers\AppController;

Route::get('/', [AppController::class, 'index']);
9 changes: 9 additions & 0 deletions vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import fs from 'fs';
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import tailwindcss from '@tailwindcss/vite';
import vue from '@vitejs/plugin-vue';

export default defineConfig({
server: {
Expand All @@ -21,5 +22,13 @@ export default defineConfig({
refresh: true,
}),
tailwindcss(),
vue({
template: {
transformAssetUrls: {
base: null,
includeAbsolute: false,
},
},
}),
],
});
Loading
Loading