php - URL routing when the ID is in center of the url
Get the solution ↓↓↓Solution:
You should use url(), you can use route() by calling the name of the route.
<a href="{{ url('project/'.$pid.'/tasks') }}" class="btn btn-primary btn-xs"><i class="fa fa-tasks"></i> Tasks </a>
Answer
Solution:
Try this :
@php
$pid=$project->id;
@endphp
<a href="{{ url('project/'.$pid.'/tasks') }}" class="btn btn-primary btn-xs"><i class="fa fa-tasks"></i> Tasks </a>
Answer
Solution:
{{ url('/project/tasks/', [$pid]) }}
i think its is bad practice to use relative path. i recommend to you always use link to route because any time if you want to change url .you will need to change it manually.urls could be 100 or 1000 to change.which is dangers for app
{{ route('route name', ['id' => $pid]) }}
Answer
Solution:
<a href="{{ url('project')}}/{{$pid}}/tasks" class="btn btn-primary btn-xs"><i class="fa fa-tasks"></i> Tasks </a>
Answer
Solution:
You should try this:
<a href="{{ url('project/tasks', $pid) }}" class="btn btn-primary btn-xs"><i class="fa fa-tasks"></i> Tasks </a>
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: illegal string offset
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.