I want to store user configuration data on database and I\'m following this forum thread about it http://forumsarchive.laravel.io/viewtopic.php?id=10406 but when I implemented i
While running TestCase in Laravel 6.x and above, I often encounter this error. I realized that the unit test is extended from PHPUnit TestClass rather than Laravel TestCase. So change PHPUnit\Framework\TestCase;
to Tests\TestCase
.
<?php
use Tests\TestCase;
class ArtifactTest extends TestCase{
}
go to bootstrap/app.php
Just uncomment
$app->withEloquent();
Working with models in your settings files is not the best way to use them.
Your problem is, that your model query started BEFORE Laravel started it's services. That's why, when you try to make your query, model can't resolve it's connection, because DB service hasn't been initiated.
If you want do this stuff, create your own ServiceProvider and update your config there, or do it right in the boot
method of your existing AppServiceProvider
.