Add missed UsePostgres Trait
This commit is contained in:
parent
03c4b87cdd
commit
64a887212d
21
app/Traits/UsePostgres.php
Normal file
21
app/Traits/UsePostgres.php
Normal 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');
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user