mpociot/laravel-test-factory-helper

Supplying custom data to belongsTo relations creates unwanted data

JoannesJ opened this issue · 1 comments

When supplying the factory()->create function with a property that has a belongsTo relation, the factory will still create its own model object for the already satisfied relation.

This can be prevented by wrapping the model creation in a closure, as suggested by the Laravel documentation: https://laravel.com/docs/master/testing#model-factories

Fixed in version 0.2.1