1

I have grid with multiple column and one of it for me to press the edit button so I can pass the id and on the route I will call the sql and get the relevant values and call the edit view. Below is my codes how I pass the id value.

<td><a href="{{url('/edittestdetails/',{{$test->ID}})}}>Edit</a></td>. I prefer the url to be edittestdetails?id=value? but now nothing is appearing when I call the url the paramereter is not appearing.

2 Answers 2

1

The correct syntax is:

<a href="{{ url('/edittestdetails/', $test->id) }}>Edit</a>

{{}} will be converted to the echo() clause, so you can't use {{}} inside another {{}} construction.

Also, property name is id by default and not ID.

Sign up to request clarification or add additional context in comments.

5 Comments

I tried for other the second slash must be removed. So what changes must I do to my route then ? Cause in there I prepared for edittestdetails?id=value but I am receiving as edittestdetails/1
@user5313398 in this case you should manually add parameters "{{ url('/edittestdetails') }}?id=value" OR {{ url('/edittestdetails', ['id' => $value]) }}. The second one will work if you're using a route withour any parameters.
Ok I have change my route to accept the id Route::get('edittestdetails/{ID}', 'EdiTestController@index'); so which one is better doing this way or the traditional with query string?
Using edittestdetails/{id} is better than edittestdetails?id=
Any reason to this cause I just change to this edittestdetails/{id}
1
<td><a href="{{ url('/edittestdetails/', $test->ID) }}">Edit</a></td>

1 Comment

I tried for other the second slash must be removed. So what changes must I do to my route then ? Cause in there I prepared for edittestdetails?id=value but I am receiving as edittestdetails/1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.