Skip to content

Conversation

@cosmastech
Copy link
Contributor

I started a new job and some of the legacy code has models with appended attributes. In wanting to improve speed of tests, I have been refactoring pagination tests to leverage Model@fillAndInsert(). I was confused as to why the inserts were failing only to discover the appends properties were the root cause.

User::query()->fillAndInsert( User::factory() ->count(100) ->make() ->each(fn ($u) => $u->setAppends([])) );

With this change, I can make this a bit cleaner:

User::query()->fillAndInsert( User::factory() ->count(100) ->make() ->withoutAppends() );
@taylorotwell taylorotwell merged commit a4623c2 into laravel:12.x Oct 28, 2025
68 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants