Undefined array key 0 when hash id doesn't exist
Falkan3 opened this issue · comments
When trying to find a model using a hash id that doesn't exist, this exception is thrown:
Undefined array key 0
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.