Level 55
@kossiecoder check your UserFactory. It must be
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = User::class;
but you have
protected $model = Model::class;
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have warning on phpstorm
Incompatible types: Expected property of type '\App\Models\User', '\Illuminate\Database\Eloquent\Collection|\Illuminate\Database\Eloquent\Model' provided
private User $user;
protected function setUp(): void
{
parent::setUp();
$this->user = User::factory()->create();
}
new factory returns Model instead of User.
Is there a way to return User instead of Model?
Thanks.
Please or to participate in this conversation.