Autowire database connection.

This commit is contained in:
Krzysztof Płaczek
2025-05-14 13:14:57 +02:00
parent dc287aadc6
commit f30304cbe9
5 changed files with 27 additions and 14 deletions

View File

@@ -21,15 +21,13 @@ class ScrapeWebsite extends Command
{
private Client $client;
public function __construct(protected Capsule $database)
{
parent::__construct();
}
protected function configure(): void
{
$capsule = new Capsule;
$capsule->addConnection([
'driver' => 'sqlite',
'database' => __DIR__ . '/../../database.sqlite',
]);
$capsule->setAsGlobal();
$capsule->bootEloquent();
$this->client = new Client();
}