osherdo's avatar

How to create link with blade templating

Hey I want to create a link to other page in my app. How do I do it with laravel's blade engine?

0 likes
6 replies
Snapey's avatar

Start with leaning about Routing. Its not an issue related to Blade since you just create a link with the name of the other page.

osherdo's avatar

I am actually trying to write a link (just like ahref) to another page in the app. I don't need routing for this - right?

Snapey's avatar
Snapey
Best Answer
Level 122

@osherdo - no, you just need to know the name of the route, or the URL. So you do need to know how your page will be referenced and if you want to create and use a named route. Otherwise, it's just plain html.

You can use plain html like <a href='/about'>About</a>

or you can use helpers to named routes <a href='{{ route('about') }}'>About</a> (which I personally dislike)

or you can use a URL helper <a href='{!! url('/about'); !!}'>About</a>

These last two are URL helpers, and the only blade element is how to insert content with double braces or {!! for raw html.

6 likes
snainwal's avatar

I am unable to link pages can anyone help me?

Please or to participate in this conversation.