How to use route name in url in Laravel?

php artisan route: the list is as follows:

 | GET|HEAD  | posts/{post}/edit | posts.edit    | App\Http\Controllers\PostController@edit        | web      

how to use the route name 'posts.edit' so that it appears in the blade.php file?

I am currently using the Laravel HTML package and am writing {{ Html::linkRoute('posts.edit', 'Edit', array($post->id), array('class'=>'btn btn-primary btn-block')) }}

but I would like to use simple html in the blade template engine without the Laravel HTML package. Is there a way to use the route name "posts.edit" in the click file?

+4
source share
1 answer

You usually use it with route()helper:

<a href="{{ route('posts.edit', ['id' => $post->id]) }}">Link</a>

In this case, you do not need to use the Laravel collective HTML package.

+3
source

Source: https://habr.com/ru/post/1661145/


All Articles