I am a bloody beginner when it comes to Laravel and although I managed to create individual links from a number of article titles to their respective details I am totally lost when trying to create individual links for any of these articles to pages that need to know about the article id:
Main page with
article1 (id_a1) -> detail_page (id_detp1) for article1 (id_a1) using id_a1 (that works)
article1 (id_a1) -> diff_page (id_diffp1) but associated only with article1 (id_a1) (needs help)
-----------------
article2 (id_a2) -> detail_page (id_detp2) for article2 (id_a2) using id_a2 (that works)
article2 (id_a2) -> diff_page (id_diffp1) but associated only with article2 (id_a2) (needs help)
I.e. each main article has 2 links: one to edit/delete the article, and the other to a page that shows a number of different but related articles.
Any help is very much appreciated.
Say you had an article controller, and it has a show method that needs an article number. You could name this route article.show and then in the view, create link like
So we created a link, using the name of the article. The route helper creates the href attribute using the name of the route. Passing the article into the route helper, Laravel will get the key for the article and include it in the route.
Thanks for your reply. I am not surprised that you could not follow my question. I struggled with it when I wrote it.
Your example is what I used to stay within the boundaries of the article. But I need to link to a page outside of the "article". That's why I am struggling. I cannot provide actual code because code to address my problem is what I am looking for.
How do I get the article id into a route that has nothing to do with the article other than that I need to have the article id available in the other route so I can use it there.