question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error in render: "Error: Ziggy error: 'project' parameter is required for route 'projectPage'."

See original GitHub issue

Ziggy version

v1.2.0

Laravel version

7.30.4

Description

ziggy is incorrectly asking for a parameter being passed to the route() function

this is especially odd because the code causing this error is nearly identical, varying only in the name of the prop array being stepped through, to a page which is working as expected

Ziggy call and context

route call

<inertia-link :href="route('projectPage', projects(r, c))">
    <ProjectCard :project="projects(r,c)"/>
</inertia-link>

route definition in web.php

Route::get('projects/{project:id}', [ProjectController::class, 'projectPage'])->name('projectPage'); //*

projects() function which is passing the project param to the named route

    methods: {
        projects(r,c) {
            if(r > 1) {
                var index;
                index = ((r * 3) - (3 - (c - 1)));
                return this.$page.props.officeProjects[index];
            }
            return this.$page.props.officeProjects[c - 1];
        }
    }

officeProjects is a properly populated array of database records, and as i said, this code exists identically, except stepping though this.$page.props.schoolProjects, which is populated in the same way, yet it does not return this error on the other page and the links route to the correct page



### Ziggy configuration

```js
projectPage:
    bindings:
        project: "id"
        __proto__: Object
    methods: (2) ["GET", "HEAD"]
    uri: "projects/{project}"
    __proto__: Object


### Route definition

```php
route definition in web.php

Route::get('projects/{project:id}', [ProjectController::class, 'projectPage'])->name('projectPage'); //*

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:19

github_iconTop GitHub Comments

1reaction
liam-otcommented, Jun 7, 2021

hey when the db is populated with at least 8 records for each table being queried the pages work as they are supposed to and your <pre>... code prints as expected, so just a problem with my math, thanks for the help and happiness your way my friend

0reactions
liam-otcommented, Jun 7, 2021

no it does not, and right now no, i need to just find another way thanks for all the help

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ziggy error: 'id' parameter is required for route - Laracasts
Hi I am working inertia and laravel single page app. I am getting error as Uncaught (in promise) Error: Ziggy error: 'id' parameter...
Read more >
Error: Ziggy error: 'id' parameter is required for route
I am working on single SPA using laravel and inertia js. I am using multi language as well. So I am passing language...
Read more >
Ziggy error: 'project' parameter is required for route 'projectPage'.
Error in render : "Error: Ziggy error: 'project' parameter is required for route 'projectPage'."(Neatstudio.COM)
Read more >
Ziggy error: 'id' parameter is required for route 'page.profile
Has anyone encountered this error? I'm using the latest Laravel install with Vue 3.0.5. I'm not really certain what the issue here is, ......
Read more >
Ziggy error: 'blog' parameter is required for route 'blogs.show ...
Coding example for the question Uncaught Error: Ziggy error: 'blog' parameter is required for route 'blogs.show'-laravel.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found