create([ 'category_type' => 'asset' ]); $model = AssetModel::factory()->create([ 'category_id' => $category->id, ]); $asset = Asset::factory()->create([ 'model_id' => $model->id ]); $this->assertEquals(1, $model->assets()->count()); } }