livewire / volt

Volt is an elegantly crafted functional API for Livewire.
https://livewire.laravel.com/docs/volt
MIT License
312 stars 19 forks source link

Volt Route Bug #80

Closed egekibar closed 7 months ago

egekibar commented 7 months ago

Volt Version

1.6.0

Laravel Version

10.34.2

PHP Version

8.2.13

Database Driver & Version

Sail with PSQL

Description

page.blade.php

<?php

use function Livewire\Volt\{layout, state, title, mount};

layout("components.layouts.guest");

mount(function (\App\Models\Page $page){
    dd($page->slug);
});

routes/web.php

Volt::route('/{page:slug}', 'page');

Error


Illuminate \ Database \ QueryException

SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for type bigint: "test-page" CONTEXT: unnamed portal parameter $1 = '...'
SELECT * FROM "pages" WHERE "id" = test-page limit 1
nunomaduro commented 7 months ago

@egekibar Can you provide the full stack trace please?

egekibar commented 7 months ago

@egekibar Can you provide the full stack trace please?

web.php

Volt::route('/scan/{lift:lift_id}', 'scan.index');

scan.index

mount(function (\App\Models\Lift $lift){
    dd($lift->lift_id);
});

https://flareapp.io/share/LPlK36Qm

nunomaduro commented 7 months ago

@egekibar Are you able to get that specific route model binding work with regular Livewire full page components?

egekibar commented 7 months ago

this works

Route::get('/laravel/{lift:lift_id}', function (\App\Models\Lift $lift){
   dd($lift->lift_id);
});

this works too

Route::get('/livewire/{lift:lift_id}', \App\Livewire\Testscan::class);