clrghouz/app/Traits/UsePostgres.php
2021-09-08 22:10:27 +10:00

21 lines
481 B
PHP

<?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');
}
}