ホーム > Laravel > How to create links in Laravel
Laravel

How to create links in Laravel

Thank you for your continued support.
This article contains advertisements that help fund our operations.

⇨ Click here for the table of contents of Laravel articles

This article summarizes how to create links in Laravel.

Premise

Make sure the page is already displayed when entering the URL directly.

Please refer to the following article for how to write page routing.

Basic way of writing routing in Laravel 8

【For beginners】I want to specify a name for Laravel routing

Conclusion

<a href="{{ route('next.index') }}">Go to next page</a>

Explanation

With a normal a tag

When writing like this:

<a href="/next"></a>

Replace the href part with:

href="{{ route('next.index') }}"

By using curly braces:

{{ }}

you can use Laravel functions and use the name prepared in routing with:

route('next.index')

Routing (Laravel 8 writing)

Route::get('next',[App\Http\Controllers\NextController::class,'index'])->name('next.index');

The name specified here:

name('next.index')

can be used as:

route('next.index')

Laravel 6 routing writing can be found in this article.

Summary

Above, I wrote about how to create links in Laravel.

There are various ways to do it, but personally, I recommend using this method with route, so I only wrote about this method.

I hope this can be useful for someone.

For feedback or complaints, please contact me on Twitter DM.

That's all!

Popular articles

Deploying a PHP 7.4 + Laravel 6 project to AWS EC2

【For beginners】How to create posting functionality in Laravel (like a bulletin board)

Please Provide Feedback
We would appreciate your feedback on this article. Feel free to leave a comment on any relevant YouTube video or reach out through the contact form. Thank you!