Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

magtechpro's avatar

How to make a route with hashtag href

Hi,

I have menu links which points to different pages with css animation. My anchor tag is look like this

I create a route for this link but it does not work.

<a href="#about" class="icon-a fas fa-user-tie"></a>

"Route::get('#about',function () {
    return view('about');
});

can any one please help me to accomplish this.

Thanks

0 likes
3 replies
tisuchi's avatar

@magtechpro

This is how you need to do that-

// Controller
Route::get('/about', array('as' => 'custom_paint', 'uses' => 'PagesController@services'));

// View
<a href="{{ URL::route('custom_paint') }}#yourHashTagHere">LINK</a>
magtechpro's avatar

Do I have to create method in Controller as per your suggestion? little confuse where do i put the controller code what you wrote.

Thanks in advance

Please or to participate in this conversation.