1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <?php
-
- namespace Illuminate\Queue\Connectors;
-
- use Illuminate\Queue\DatabaseQueue;
- use Illuminate\Database\ConnectionResolverInterface;
-
- class DatabaseConnector implements ConnectorInterface
- {
- /**
- * Database connections.
- *
- * @var \Illuminate\Database\ConnectionResolverInterface
- */
- protected $connections;
-
- /**
- * Create a new connector instance.
- *
- * @param \Illuminate\Database\ConnectionResolverInterface $connections
- * @return void
- */
- public function __construct(ConnectionResolverInterface $connections)
- {
- $this->connections = $connections;
- }
-
- /**
- * Establish a queue connection.
- *
- * @param array $config
- * @return \Illuminate\Contracts\Queue\Queue
- */
- public function connect(array $config)
- {
- return new DatabaseQueue(
- $this->connections->connection($config['connection'] ?? null),
- $config['table'],
- $config['queue'],
- $config['retry_after'] ?? 60
- );
- }
- }
|