Changes model connection property to use the Connection attribute
use Illuminate\Database\Eloquent\Model;
+use Illuminate\Database\Eloquent\Attributes\Connection;
+#[Connection('sqlite')]
class User extends Model
{
- protected $connection = 'sqlite';
}
Configure your rector.php:
<?php
use RectorLaravel\Rector\Class_\ConnectionPropertyToConnectionAttributeRector;
use Rector\Config\RectorConfig;
return RectorConfig::configure()
->withRules([
ConnectionPropertyToConnectionAttributeRector::class,
]);