I have defined route
Route::get('/edit-industry/{id}', 'Industries@edit')->name('admin.editIndustry');
And passing variable by
{{ route('admin.editIndustry', ['id'=>1]) }}
OR
{{ route('admin.editIndustry', [1]) }}
This is not working. How to pass variable here?
You can pass query string to URL in laravel using named route and controller action. You can pass query string as comma separated array to named route and controller action and redirect to URL.
wow, why are wrong answers (or answers for questions which were not asked in this case) upvoted?
EkinOf is correct, you can do
{{ route('admin.editIndustry', 1) }}
Btw your first one works too and is necessary, if you have more than 1 parameter
{{ route('admin.editIndustry', ['id'=>1]) }} {{ route('admin.editIndustry', ['id'=>1, 'something'=>42]) }}
If you have only one parameter you can do that :
{{ route('admin.editIndustry', 1) }}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With