mercredi 1 août 2018

Laravel - how to get the "resource $connection"

I need to use the pg_copy_from() function from php in Laravel 5.5 and i want to know how can i get the "resource $connection" in Laravel to pass on the first argument of this function.

I've already test creating a new connection using the pg_connect() function and works OK, but i want to use the connection that i have on Laravel.

I dont know if helps but this is my dd(DB::connection());

PostgresConnection {#218 ▼
#pdo: Closure {#216 ▼
    class: "Illuminate\Database\Connectors\ConnectionFactory"
    this: ConnectionFactory {#39 …}
    use: {▼
    $config: array:11 [▼
        "driver" => "pgsql"
        "host" => "localhost"
        "port" => "5432"
        "database" => "dbtest"
        "username" => "postgres"
        "password" => ""
        "charset" => "utf8"
        "prefix" => ""
        "schema" => "public"
        "sslmode" => "prefer"
        "name" => "pgsql"
    ]
}
file: "/srv/www/testapp/vendor/laravel/framework/src/Illuminate/Database/Connectors/ConnectionFactory.php"
line: "178 to 192"



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire