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

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'); //*

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 19

Most upvoted comments

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