Pesilizium's avatar

Route is making URL from & to &

I have a small problem. I want to pass two variables via GET. Unfortunately, in the URL, & becomes &. As a result, the variable polnr can no longer be identified.

Here is my Blade code:

<x-link-button href="{{ route('dokument.index', ['kdnr' => $kfz->kkdnr, 'polnr' => $kfz->kpolnr]) }}">Documents</x-link-button>

This is my web.php:

Route::resource('dokument', DokumentController::class)
        ->only(['index', 'store', 'edit', 'update', 'create', 'destroy']);

This is my Request->query:

Symfony\Component\HttpFoundation
\
InputBag {#51 ▼
    #parameters: array:2 [▼
      "kdnr" => "1414"
      "amp;polnr" => "8462691"
    ]
  }

When I manually change the URL from & to &, everything works perfectly. Unfortunately, amp; is appended to the variable in my case.

Where is the error here?

I hope you can help me out.

0 likes
3 replies
Tray2's avatar
Tray2
Best Answer
Level 73

Try changing the code to this

<x-link-button :href="route('dokument.index', ['kdnr' => $kfz->kkdnr, 'polnr' => $kfz->kpolnr])">Documents</x-link-button>

The attribute should be sent as a prop and not as a string, the string gets converted to safe output.

Please or to participate in this conversation.