You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the moduleRoute helper function, $parameters is allowed to be passed in as an int or a string, in addition to an array; however, the variable is then passed to array_merge without any type conversion, and throws an error.
So, given a route defined as: Route::get('/parent/{parentId}/child/{childId}/type/{type}', [Controller::class, 'show')->name('show');
Calling route('show', parameters: ['type' => 'thing', 123, 456]) would generate the url http://domain.com/parent/123/child/456/type/thing.
Getting back to moduleRoute, if we only want to pass parameters as associative arrays, here are the lines we would have to update:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
In the
moduleRoutehelper function,$parametersis allowed to be passed in as anintor astring, in addition to anarray; however, the variable is then passed toarray_mergewithout any type conversion, and throws an error.Related Issues
Fixes #2780