// Option 1: Manually
this.$inertia.post(`/toggle-thing/${this.user.id}`, {}, { preserveScroll: true })
<!-- Option 2: Inertia Link -->
<inertia-link :href="`/toggle-thing/${user.id}`" preserve-scroll>Toggle</inertia-link>
import { createSSRApp, h } from 'vue' | |
import { renderToString } from '@vue/server-renderer' | |
import { createInertiaApp } from '@inertiajs/inertia-vue3' | |
import { resolvePageComponent } from 'laravel-vite-plugin/inertia-helpers'; | |
import createServer from '@inertiajs/server' | |
createServer(page => | |
createInertiaApp({ | |
page, | |
render: renderToString, |
<?php | |
TestResponse::macro('inertiaSnapshot', function (...$keys) { | |
$convertPlainValueToCode = function ($value) { | |
if ($value === null) { | |
return 'null'; | |
} elseif (is_bool($value)) { | |
return $value ? 'true' : 'false'; | |
} elseif (is_string($value)) { | |
return "'".addslashes($value)."'"; |
import { Inertia } from '@inertiajs/inertia' | |
document.addEventListener('click', (event) => { | |
if ( | |
event.target.tagName.toLowerCase() === 'a' && | |
event.target.hasAttribute('inertia') && | |
!event.target.isContentEditable && | |
!event.defaultPrevented && | |
!event.shiftKey && | |
!event.ctrlKey && |
<?php | |
use getID3; | |
$id3 = (new getID3())->analyze(Request::file('file')->getPathname()); | |
$duration = isset($id3['playtime_string']) ? str_pad($id3['playtime_string'], 8, '00:00:00', STR_PAD_LEFT) : null; |
<template> | |
<inertia-head> | |
<title v-if="title">{{ title }} - My App</title> | |
<title v-else>My App</title> | |
<slot /> | |
</inertia-head> | |
</template> | |
<script> | |
export default { |
<?php | |
namespace App\Models; | |
use Illuminate\Support\Facades\Session; | |
use Illuminate\Database\Eloquent\Model as Eloquent; | |
abstract class Model extends Eloquent | |
{ | |
protected $guarded = []; |
// Option 1: Manually
this.$inertia.post(`/toggle-thing/${this.user.id}`, {}, { preserveScroll: true })
<!-- Option 2: Inertia Link -->
<inertia-link :href="`/toggle-thing/${user.id}`" preserve-scroll>Toggle</inertia-link>
<template> | |
<input type="text" :value="address" @input="$emit('update:address', $event.target.value)"> | |
<input type="text" :value="city" @input="$emit('update:city', $event.target.value)"> | |
<input type="text" :value="region" @input="$emit('update:region', $event.target.value)"> | |
<input type="text" :value="country" @input="$emit('update:country', $event.target.value)"> | |
<input type="text" :value="postal" @input="$emit('update:postal', $event.target.value)"> | |
</template> | |
<script setup> | |
import { defineProps } from 'vue' |
<?php | |
namespace App; | |
use Exception; | |
use Illuminate\Database\Eloquent\Model as Eloquent; | |
class Model extends Eloquent | |
{ | |
public function getRelationshipFromMethod($name) |
<?php | |
namespace App\Providers; | |
use Inertia\ServiceProvider; | |
use Illuminate\Http\Request; | |
class InertiaServiceProvider extends ServiceProvider | |
{ | |
/** |