mardi 30 janvier 2018

How create service provider (singleton)?

I have such function which create new connection when I call it:

public function newBaseQueryBuilder()
{
   ...
   $host = config('sphinx.connection.host');
   $port = config('sphinx.connection.port');
   $pdo = new \PDO("mysql:host={$host};port={$port};", '', '');
   $connection = new SphinxConnection($pdo);
   ...
}

Have create service provider which create only one connection?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2nm3OxY
via IFTTT

Aucun commentaire:

Enregistrer un commentaire