# Bind a Vue page to a route model

> Type-hint Post $post and the URL {post} resolves the row. A missing row is a 404.

- URL: https://laravel-vuejs.space/laravel-route-model-binding-vue
- Author: Anass Ez-zouaine (https://laravel-vuejs.space/author/anass-ez-zouaine)
- Published: 2026-10-11
- Topics: Laravel, VueJs, Inertia

People searching “Laravel route model binding Vue” still `Post::find($id)` and then forget the 404. Type-hint the model. The parameter name matches the route segment. The [CRUD guide](https://laravel-vuejs.space/laravel-inertia-vue-crud) uses this on edit and update.

> **TL;DR**
>
> -   Type-hint `Post $post` and the URL `{post}` resolves the row.
> -   A missing row is a 404.
> -   Do not take the id from the query string when it is already in the path.
> -   Do not pass the whole model if the page needs two columns.
>
> **Who it's for:** Laravel + Vue developers on Inertia
>
> **Applies to:** Laravel 13 · Inertia 3 · Vue 3

## The fix

```php
Route::get('/posts/{post}', [PostController::class, 'show'])->name('posts.show');
```

```php
public function show(Post $post): Response
{
    return Inertia::render('posts/Show', [
        'post' => $post->only(['id', 'title']),
    ]);
}
```

`/posts/15` loads post 15. `/posts/99999` is a 404 before the method runs. The Vue page always receives a post.

A nested route such as `/posts/{post}/comments/{comment}` should scope the comment to the post. `scopeBindings()` on the route group does that. Without it, a comment id from another post still resolves.

## What to avoid

> **Gotcha**
>
> Do not take the id from the query string when it is already in the path. Do not pass the whole model if the page needs two columns. `only()` keeps the payload small.

## FAQ

**Q: How do I bind a Vue page to a route model?**

Type-hint Post $post and the URL {post} resolves the row. A missing row is a 404.

**Q: What goes wrong with Laravel route model binding Vue?**

Many developers still `Post::find($id)` and then forget the 404. Do not take the id from the query string when it is already in the path.
