Feature Example Test fails when using queries in Service Provider
Steps to reproduce:
Create a new Laravel App
Add any eloquent query in AppServiceProvider say User::first()
Upon running Feature/ExampleTest.php, it fails. You can also use RefreshDatabase trait but it keeps failing.
Why add an eloquent query in AppServiceProvider?
There can be various cases. Say you are running Multi-tenant application and check the tenant account, or you wish to set config dynamically from the database etc.
@VinayKesharwani Yes, in most cases Service Provider is a configuration mechanism to register some classes, not for the action of those classes itself.