I've a route with a parameter in my laravel application.
Route::get('news/update/{id?}', 'Admin\NewsController@update')->name('news.update');
How can I redirect from a blade view to the route with the parameter?
{{ route('news.update', ['id' => $_news['id']]) }}
This code redirects only to news/update?id=1
Does anyone has an idea?
Edit: The Site returns only data form a database based on the id parameter. So the GET method is ok. The parameter is optional.
{{ route('news.update', $_news['id']) }}
Try that. also, update routes probably should be Route::put()
are you sure update with use get ?
use {id}
instead of {id?}
on update