When I upgraded from laravel/framework 5.4.18 to 5.4.19 some of my unit tests broke. This is because somehow the models i get when making http requests (via the BrowserKitTest features) now have a connection provided, while the user i create via a factory and then use within the application via $this->actingAs have null as db connection. This leads to false returns when doing checks via $user->is($modelFromRouteModelBinding->user);
Use $this->actingAs($userFromFactory) in BrowserKitTests and then call some of your routes via $this->json('GET', '/test') or so. When you use checks i.e. for security like $userFromRequest->is($modelFromRouteModelBinding->user), you will get false because the connections differ (null vs the (now) correct connection).
I am also finding that in my tests the models being generated from a factory and then used via actingAs has a null return value when calling getConnection, and thus in my Controller when I check the dependency injected request user against one pulled from the db...
$request->user()->is($dbUser);
It will always fail.
I tested again on 5.4.18 and there all models generated by factory have connection set to null. That would be fine, but now the one that is loaded through route model binding has a connection != null, and that is the problem.
That's weird I've upgraded my application to v5.4.19 and the result is green as expected

The suite has unit and feature tests. I also use the acting as and the factories
Do you use the is-Function provided by Eloquent Models? I use it to compare two models and to look if they reference the same piece of data. For that it compares the key, the database table and the connection. That is where it breaks.
Yea, I'm on 5.4.19 and experiencing this issue.
I agree there's inconsistency in this area, the connection should be always set on the model instance, it's currently set when you use Model::create() but not when you use save().
The factory builder uses save() and that's why it fails, #18769 is a fix not a breaking change and I believe I can fix this issue too but will have to make multiple changes to the current test suite. Will try to look into this today.
For those who have the issue, you can set
"laravel/framework": "5.4.* !=5.4.19",
in your composer.json, to be sure to avoid it.
Most helpful comment
Fixed in https://github.com/laravel/framework/pull/18846