clrghouz/app/Traits/UsePostgres.php

21 lines
481 B
PHP
Raw Normal View History

2021-09-08 12:10:27 +00:00
<?php
/**
* Models that store data in Postgres
*/
namespace App\Traits;
trait UsePostgres
{
/**
* Resolve a connection instance.
* We need to do this, because our relations are in pgsql and somehow loading a relation changes this models
* connection information. Using protected $connection is not enough.
*
* @param string|null $connection
*/
public static function resolveConnection($connection = null)
{
return static::$resolver->connection('pgsql');
}
}