Issue
This is My index blade where I want to click on the user name and it will redirect me on the edit user blade
@extends('layouts.admin')
@section('content')
<h1><b>Users</b></h1>
<table class="table table-hover">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Profile</th>
<th scope="col">Name</th>
</tr>
</thead>
<tbody>
@if($users)
@foreach($users as $user)
<tr>
<td>{{$user->id}}</td>
<td><img height="25" src="{{$user->photo ? $user->photo->file:'No photo exist'}}"></td>
<!-- Problem is here -->
<td><a href="{{route('admin.users.edit', $user->id)}}" style="text-decoration: none">
{{$user->name}}</a></td>
*it through an exception*
**Route [admin.users.edit] not defined**
</tr>
@endforeach
@endif
</tbody>
</table>
@endsection
If I use the url()
method {{url('admin/users/edit',$user->id)}}
like this it will redirect me as admin/users/edit/1
but my route is set as admin/users/1/edit
. How can I open this route?
Solution
I will not suggest to use admin/users/1/edit
even then if you want to use this then
Change
{{url('admin/users/edit',$user->id)}}
to
{{url('admin/users/'.$user->id.'/edit')}}
Reference:
Laravel ->URL Generation -> Generating Basic Url
Answered By - Sehdev Answer Checked By - Gilberto Lyons (PHPFixing Admin)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.