close

how to pass variable in route name in laravel?

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error how to pass variable in route name in laravel? in php. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

how to pass variable in route name in laravel Error Occurs?

Today I get the following error how to pass variable in route name in laravel? in php.

How To Solve pass variable in route name in laravel Error ?

  1. How To Solve pass variable in route name in laravel Error ?

    To Solve pass variable in route name in laravel Error If you have only one parameter you can do that :
    {{ route('admin.editIndustry', 1) }}

  2. how to pass variable in route name in laravel?

    To Solve pass variable in route name in laravel Error If you have only one parameter you can do that :
    {{ route('admin.editIndustry', 1) }}

Solution 1

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]) }}

Solution 2

If you have only one parameter you can do that :

{{ route('admin.editIndustry', 1) }}

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read

Leave a Comment