1

I want to pass two parameters in url. My url is http://localhost/buyforfund/fundraising/public/campaign_details/64

I want this url :
http://localhost/buyforfund/fundraising/public/campaign_details/64/campaign_product_details/26
on button click I want this url and I give the button link from route name. But an error occurs.

button link:

<a href="{{ route('campaign_product_details.detail',$result->id) }}" class="hvr-float-shadow">View</a>

Error:

Missing required parameters for [Route: campaign_product_details.detail] [URI: campaign_details/{campaign_id}/campaign_product_details/{product_id}].

My route:

Route::get('campaign_details/{campaign_id}/campaign_product_details',function(){
        return view('/front/campaign_product_details');
    });
Route::get('campaign_details/{campaign_id}/campaign_product_details/{product_id}','front\CampaignDetailsController@showCampaignProductDetails')->name('campaign_product_details.detail');
3
  • Do you have issue in route or into your link tag? Commented Mar 28, 2018 at 5:59
  • 1
    i have issue in link tag @DarshanJain Commented Mar 28, 2018 at 6:03
  • See my answer as mentioned below. I hope you will get the idea about the same. Commented Mar 28, 2018 at 6:06

3 Answers 3

3

Try to pass two parameters like below:

Route::get('campaign_details/{campaign_id}/campaign_product_details/{product_id}', [
'as' => 'showCampaignProductDetails', 'uses' => 'CampaignDetailsController@showCampaignProductDetails']);

In your view:

route('showCampaignProductDetails',['campaingn_id'=>$campaign_id,'product_id'=>$productId]);
Sign up to request clarification or add additional context in comments.

2 Comments

Glad to help you! @Bhoomipatel
how to pass multiple optional parameters in route?
0

In your a tag second parameter is missing

<a href="{{ url('campaign_details/$result->id/campaign_product_details/$product_id }}" title="Edit signature">

You have define second parameter too.

Comments

0

Also pass the product id

<a href="{{ route('campaign_product_details.detail',$result->id,$product->id) }}" class="hvr-float-shadow">View</a>

Comments

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.