Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Getting ID from the table blade.php to other blade.php error Symfony\Component\Routing\Exception\RouteNotFoundException

I have a table view in which I have a view button and redirect to another page carrying the id of the row that has been clicked.

<tbody>
  <tr>
   <?php $hold=0; ?>
   @if(!empty($users))
    @foreach($users as $user)
      @if($user->role == 3)
       <?php $hold++; ?>
        <td class="py-1">{{ $user->id }}</td>
        <td>{{ $user->name }} </td>
        <td>{{ $user->Zone }} </td>
        <td>{{ $user->Purok }}</td>
        <td> Wala pa sa database </td>
        <td>
          <div class="template-demo">
            <button type="button" onclick="location.href=' {{ route ('SupAd.View_PL_Accnt/'.$user->id) }}'"  class="btn btn-outline-info btn-icon-text">
             <i class="ti-search btn-icon-append"></i>View
              </button>
            </div>
         </td>
    </tr>
    @endif
    @endforeach
    <?php  if($hold == 0){
      echo "<p><font color=red size='4pt'>No purok leader can be found</font></p>";
    }
    ?>
    @endif

I have here my code on web.php route

Route::group(['prefix'=>'SupAd_Purok_Leader_Account', 'middleware'=>['isSupAd', 'auth', 'PreventBackHistory']], function (){
 Route::get('View_PL_Accnt', [SupAdController::class, 'View_PL_Accnt'])->name('SupAd.View_PL_Accnt/{id}'); });

And I got the error:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Symfony\Component\Routing\Exception\RouteNotFoundException
Route [SupAd.View_PL_Accnt/3] not defined.

>Solution :

You are placing the route parameter in the wrong place. Try this:

Route::get('View_PL_Accnt/{id}', [SupAdController::class, 'View_PL_Accnt'])->name('SupAd.View_PL_Accnt'); });

The name is used to call a route using the route helper. You can give the url parameters to the route helper in an array. Inside your blade file use:

{{ route ('SupAd.View_PL_Accnt', [$user->id]) }}
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading