Laravel 5 - 通过带有内部路由的 href 发送变量
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/29564167/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 11:20:03 来源:igfitidea点击:
Laravel 5 - Sending a variable through an href with a route inside
提问by Miguel Rebola
I have this code:
我有这个代码:
@foreach($clientes as $cli)
<tr>
<td>{{$cli->id}}</td>
<td>{{$cli->nome}}</td>
<td>{{$cli->bi}}</td>
<td>{{$cli->telefone}}</td>
<td>{{$cli->morada}}</td>
<td>{{$cli->cp}}</td>
<td>{{$cli->email}}</td>
<td>{{$cli->valido}}</td>
//<td><a href="{{$url = route('a_clientes'){{$cli->id}}"></td>
</tr>
@endforeach
I want to edit the line with the //.
我想用 // 编辑该行。
What I need to do is create a new column in the table with an href
inside that redirects the user to a page where he can change the record of the $cli
with that id.
我需要做的是在表中创建一个新列,其href
内部将用户重定向到一个页面,在那里他可以更改$cli
具有该 ID的记录。
回答by user1669496
The syntax is a little off...
语法有点不对...
<td><a href="{{ route('a_clientes', $cli->id ) }}">Edit</a></td>