Anyone who experience this issue with anchor tags at laravel , I encounter an issue which href shows correct url href="job
but the properties value shows = jobs/jobs
. I don’t have any issue with this anchor tags when I’m in different routes.
I used this route
Route::get('/jobs/{id}', function ($id) {
$job = Job::find($id);
return view('job',['job'=>$job]);
});
I try to look for any similar issue here but I found nothing. the anchor tag is reusable , I did used a static anchor tag but both shows values /jobs/jobs but the href is /jobs only
@props([‘active’ => false])
<a class="{{ $active ? 'bg-gray-900 text-white' : 'text-gray-300 hover:bg-gray-700 hover:text-white' }} rounded-md px-3 py-2 text-sm font-medium"
aria-current="{{ $active ? 'page' : 'false' }}"
{{ $attributes }}
>{{$slot}} </a>
2
Answers
I don't know if this is how you solved this but I try to changed the href=""
to {{ url(name_path) }}
If you’re using a reusable Blade component for your anchor tags, ensure that the href attribute is being set correctly.
Or Add some debugging statements to check the values being passed to your Blade component.
{{– Debugging –}}