1

This is my route and I get a status variable but I want to set it up so that that if the status does not come then it must has a default parameter.

Route::get('/list/{status?}', [
    'as' => 'entegra.gg.p.list',
    'uses' => 'ggController@ggList'
]);

I want to set the default parameter for status variable. How can I do that ?

I set the parameter like this but I need to set up a default parameter:

<li><a href="{{ route('entegra.gg.p.list', ['status' => 'A']) }}">@lang('gg\index.sales.A')</a></li>

1 Answer 1

2

You can set that in your method.

public function ggList($status = "default") {
    // do your magic...
}

If anything comes from the url, it will be overwritten.

Sign up to request clarification or add additional context in comments.

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.