0

I want to make url like this http://127.0.0.1:8000/post/edit_1=1&edit_2=2 to pass to my controller

I try route like this Route::get('post/edit_1={id}&edit_2={id2}', 'PostController@index')->name('post.index');

and View like this <a href="{{ route('post.index', '$id', '$id2') }}">Click Here</a>

But I always got error, can someone fix my code

liliz
  • 3
  • 1
  • Use `/` instead `=` and `&` – Niklesh Raut Apr 24 '18 at 05:26
  • 1
    1st - you can't declare `GET` parameters in your route definitions, 2nd - `http://127.0.0.1:8000/post/edit_1=1&edit_2=2` is a mix of what it seems like 2 `GET` parameters, but it doesn't start with `?`, so it's incorrectly formatted 3. - if you get an error, post what the error says – DevK Apr 24 '18 at 05:27
  • devk is right you should you proper route and url to match. – Niklesh Raut Apr 24 '18 at 05:31
  • Your url should be like http://127.0.0.1:8000/post?edit_1=1&edit_2=2 Check https://stackoverflow.com/a/24745203/6429700 – Nirali Apr 24 '18 at 05:35

1 Answers1

1

i think a simple route like this

Route::get('post/{1}/{2}', 'PostController@index')->name('post.index') 

and call

<a href="{{ route('post.index', ['$id','$id2'] )}}">Click Here</a>
Me Loon
  • 24
  • 3