Support the ongoing development of Laravel.io →
Views Blade Forms

So I'm going through the Laravel 5 Fundamentals cast and I thought I would just make a link that would help with the edit article section.

I first tried:

{!! link_to_route(route('articles.edit', $article->id), 'Edit this post') !!}

And that wasn't flying. The error was stating that the route didn't exist, although it was printing the correct route and could be pasted into the browser and visited successfully.

I ended up using the below code to accomplish what I wanted:

<a href="{{ action("ArticlesController@edit", $article->id) }}">Edit this post</a>

Is there a cleaner way to accomplish this kind of link or button?

Thanks in advance

Last updated 3 years ago.
0

As you can see here: http://laravel.com/docs/4.2/helpers#urls

link_to_route works in this way:

link_to_route('articles.edit', 'Edit this post', ["article"=>$article->id]);

I don't know in laravel 5, however I don't think you should use route helper inside link_to_route helper

Last updated 10 years ago.
0

Thank you very much that clears things up and works perfectly.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

dbassassin dbassassin Joined 18 Jun 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.