[英]laravel which route or link should I use for this case
I have an xmldocument
model, which I can show its profile in this way: 我有一个
xmldocument
模型,可以通过这种方式显示它的配置文件:
`public/xmldocument/4`
From this page, there are three links, which are: 此页面上有三个链接,分别是:
add general information
add master information
add general information
each of them is for a resource. 他们每个人都是资源。 for example:
例如:
add general information is the create of the resource general_information
添加常规信息是资源
general_information
的创建
add master information is the create of the resource master_information
添加主信息是资源
master_information
的创建
add general information is the create of the resource general_information
添加常规信息是资源
general_information
的创建
But each of them must know the xmldocument id. 但是他们每个人都必须知道xmldocument ID。 in my case, each of them should know that they are belongs to the
xmldocument = 4
就我而言,每个人都应该知道它们属于
xmldocument = 4
My question is should I route each of them to this link 我的问题是我应该将每个人都路由到此链接吗
`public/xmldocument/4/generalinformation/create` ?
or to this link 或此链接
`public/generalinformation/create` ?
in the second case, I have to pass the xmldocument id, but can I really do that using the a
tag? 在第二种情况下,我必须传递xmldocument id,但是我真的可以使用
a
标签吗?
as Oni said, its something related to your business logic, so there are no way as the best way or a way which is better than this way, its all back to you .. 正如Oni所说,它与您的业务逻辑有关,因此,没有任何方法可以作为最佳方法或比这种方法更好的方法,所有这些都归您所有。
now about the second question sending the id of the document when using 现在关于使用时发送文档ID的第二个问题
public/generalinformation/create
in general you should append the id
of the document to the link so that you can handle it in the next page as a
tag will only provide _GET
values, but in Laravel you can use slug
for example to solve this issue so your link can be something like 一般而言,您应追加
id
的文档的链接,这样就可以在接下来的页面处理它作为a
标签将只提供_GET
值,但在Laravel可以用slug
例如要解决这个问题,所以您的链接可以就像是
public/xml_doc_slug/generalinformation/create
so this way you query your database for the slug
and get the id
of the xml document. 所以这样你查询数据库的
slug
,并获得id
的XML文档。
In my opinion, try to make your URL's as simple as you can so that you can deal with it later. 我认为,请尝试使您的URL尽可能简单,以便以后使用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.