php - Right way to build a link in laravel 5.3 -
im trying build dynamic link view page (blade) laravel 5.3.
my approach is:
<a href=" {{ url::to('articles') }}/{{ $article->id}}/edit">edit></a>
that output right url base url , other slug: http://mydomain/articles/23/edit
"23" article's id.
this works wonder if there cleaner way that?
many thanks
you can use named routes this
// route file url::get('articles/{articleid}/edit', 'articlescontroller@edit')->name('articles.edit'); //your view <a href="{{ url::route('articles.edit', $article->id) }}">edit</a>
much more cleaner imo
Comments
Post a Comment