Route with multiple parameter InertiaJS

Viewed 4784

I am using Laravel 8 with InertiaJS stack.

I am using model binding on route and resource controller.

is it possible to send multiple parameter on route() function in inertia?

I cant get the request (this.form) send by this.$inertia.put(route("rooms.update", this.form));

this is my function in the controller

/**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \App\Models\Room  $room
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, Room $room)
    {
        dd($room, $request->all());
    }

this is inertia method on vue file

this.$inertia.put(route("rooms.update", this.form));
2 Answers

Try this:

this.$inertia.put(route("rooms.update", this.room), this.form);

Assuming that room exists in props and it is the editing room.

nvm, i manage to do it by changing it to this

this.$inertia.put(
          route("rooms.update", { room: this.editingRoomUuid }),
          this.form
        );
Related