--level used: 2When I call firstOrFail() after lockForUpdate(), I get the error.
Call to an undefined method Illuminate\Database\Query\Builder::firstOrFail()
Neither first() nor get() occurs the problem.
<?php
namespace App\Models;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
class User extends Authenticatable
{
public function test()
{
return $this
->where('id', 1)
->lockForUpdate()
->firstOrFail();
}
}
Last but not least, thank you very much for creating this product!
Thank you for your report.
What is the situation when you remove lockForUpdate?
Thank you for quick response.
What is the situation when you remove lockForUpdate?
Error has gone away.
Maybe related: https://github.com/nunomaduro/larastan/issues/487#issuecomment-598030138
Hi,
Thank you for reporting. This looks like a false positive. I'll check it :+1:
Most helpful comment
Hi,
Thank you for reporting. This looks like a false positive. I'll check it :+1: