-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
::find and ::first not returning correct model #1609
Comments
Probably because
|
My workaround is using Model::first()->sole(); Model::find()->sole(); Model::findOrFail($id)->sole(); It also works great for places where you can have multiple childs on Auth::user()->roles->sole()->name https://laravel.com/docs/11.x/collections#method-sole
|
This is my patch for fixing in my projects. more in my fork https://github.com/akaDJon/laravel-ide-helper
|
Versions:
Description:
::find returns Illuminate\Database\Eloquent\Collection|null|TModel
::first returns Illuminate\Database\Eloquent\TValue|null
The text was updated successfully, but these errors were encountered: