I m trying to acces the create page from the navbar when i m under the home page i can access to the url without problem ('http://todolist.test/todo/create') but when i try to acces from the show page the url have a duplication ('http://todolist.test/todo/todo/create') "todo" repeated 2 times in url .
<ul class="navbar-nav mr-auto">
<li class="{{Request::is('/')? 'active' : ''}}">
<a class="nav-link" href="/">Home <span class="sr-only">(current)</span></a>
</li>
<li class="{{Request::is('todo/create')? 'active' : ''}}">
<a class="nav-link" href="todo/create">Create Todo</a>
</li>
</ul>
create page route Method :GET|HEAD | URI :todo/create | Name :todo.create | Action: App\Http\Controllers\TodosController@create |Middleware: web show page route Method:GET|HEAD | URI:todo/{todo} | Name:todo.show |Action: App\Http\Controllers\TodosController@show | Middleware:web
href="todo/create"
) The way that I solve it is by using theasset()
function like so:href="{{ asset('todo/create') }}"
(assuming you are in a blade file) – Rob Biermann<script>function asset(url) { return '{{ asset('') }}' + url; }</script>
inside a blade file – Rob Biermann