sameera
sameera

Reputation: 99

how to add data to parameter when using route helper, needed data store inside variable

this a tag use in table, so using table data I want to forward id to new page, here I attach my code

    <table class="table">
    <thead>
    <tr>
      <th scope="col">Add ID</th>
    </tr>
    </thead>
  @foreach($PDFS ?? '' as $PDF)
  <tr>
      <td>{{$PDF->AddID}}</td>
      <td><a href="{{route('ORP_Print_SMID',[app()->getLocale(),'id'=>'{{$PDF->AddID}}']) }}">open</a>
       </td>
    </tr>
    @endforeach
  <tbody></tbody></table>

this is not working.

but below code is working

<a href="{{ route('ORP_Print_SMID', [app()->getLocale(),'id' => '24']) }}" >find</a>

actual data in this variable is '24'

{{$PDF->AddID}} =24

how I solve this, plz help me

Upvotes: 0

Views: 23

Answers (1)

Sehdev
Sehdev

Reputation: 5662

There is no need to use {{ }} again inside {{ }}

Change

<td><a href="{{route('ORP_Print_SMID',[app()->getLocale(),'id'=>'{{$PDF->AddID}}']) }}">open</a>

to

<td><a href="{{route('ORP_Print_SMID',[app()->getLocale(),'id'=>$PDF->AddID]) }}">open</a>

Upvotes: 1

Related Questions