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

Undefined array key 0 when hash id doesn't exist #25

Open
Falkan3 opened this issue Nov 7, 2023 · 0 comments
Open

Undefined array key 0 when hash id doesn't exist #25

Falkan3 opened this issue Nov 7, 2023 · 0 comments

Comments

@Falkan3
Copy link

Falkan3 commented Nov 7, 2023

When trying to find a model using a hash id that doesn't exist, this exception is thrown:

Undefined array key 0

image

The function that is called can return the following values:

@return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection|static[]|static|null

Which is then accessed:

return $generator->decode($hashIdInstance->hashIdForKey)[0];

When a model can't be found, I suggest a null being returned instead.

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

No branches or pull requests

1 participant