Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accept null as optional parameter #581

Closed
eduardopilati opened this issue Sep 21, 2022 · 0 comments · Fixed by #582
Closed

Accept null as optional parameter #581

eduardopilati opened this issue Sep 21, 2022 · 0 comments · Fixed by #582
Assignees

Comments

@eduardopilati
Copy link

eduardopilati commented Sep 21, 2022

Description

My system has this route:

Route::get('{categoriaId?}', [CategoriaController::class, 'inicio'])->name('')->where('categoriaId', '\d+');

in my code:

let categoriaId = 1
route('categorias', categoriaId) //Works
route('categorias') //Works
let categoriaId = null
route('categorias', categoriaId) //NOT Works
Cannot read properties of null (reading 'categoriaId')
let categoriaId = null
route('categorias', categoriaId ?? undefined) //Works

Correction

Please fix route function to accept null values on optional routes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants