I've gone through many of the articles below, which explains generating link from named route, but unable to solve my problem.
Tutorial 1
Tutorial 2
Tutorial 3
Following is the defined routes:
Route::get('/nitsadmin/dashboard', function () {
return view('nitsadmin.dashboard');
});
And I'm calling link in anchor tag:
<a id="index" class="navbar-brand" href="{{Html::linkRoute('/nitsadmin/dashboard')}}">
<img src="../img/admin/nitseditorlogo.png" alt="Logo">
</a>
I'm getting following error:
Pass multiple variables to anchor tag (href) using url() helper in laravel view. You can pass the multiple variable to url in laravel using url() helper method. To pass the value using $user->id and $user->name variable to URL you have to define web route and get the user details using controller's method.
Global Constraints You can define these patterns in the boot method of your RouteServiceProvider.
For coders using routes names, simply they can use to() method:
return redirect()->to(route('dashboard').'#something');
In templates:
{{ route('dashboard').'#something' }}
You can do this quite simply with the url()
helper.
Just replace your anchor tag like so:
<a id="index" class="navbar-brand" href="{{url('/nitsadmin/dashboard')}}">
<img src="../img/admin/nitseditorlogo.png" alt="Logo">
</a>
Regarding the image that you have used in there, if these were to be stored in your public folder then you could always use the asset()
helper. This would help you turn your absolute links to in dynamic ones.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With