Add missed UsePostgres Trait

This commit is contained in:
Deon George 2021-09-08 22:10:27 +10:00
parent 03c4b87cdd
commit 64a887212d

View File

@ -0,0 +1,21 @@
<?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');
}
}