Rasyidi Alwee
Rasyidi Alwee

Reputation: 152

Route with multiple parameter InertiaJS

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));

Upvotes: 5

Views: 13733

Answers (2)

Yannick Dirbé
Yannick Dirbé

Reputation: 72

Try this:

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

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

Upvotes: 4

Rasyidi Alwee
Rasyidi Alwee

Reputation: 152

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

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

Upvotes: 6

Related Questions