mirror of
https://github.com/idanoo/laravel-resque.git
synced 2025-07-01 11:02:14 +00:00
initial commit
This commit is contained in:
parent
81d0771154
commit
c563d0e4ae
7 changed files with 189 additions and 0 deletions
43
src/ResqueServiceProvider.php
Normal file
43
src/ResqueServiceProvider.php
Normal file
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
namespace Hlgrrnhrdt\Resque;
|
||||
|
||||
use Config;
|
||||
use Hlgrrnhrdt\Resque\Console\WorkCommand;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Resque;
|
||||
|
||||
/**
|
||||
* ResqueServiceProvider
|
||||
*
|
||||
* @author Holger Reinhardt <hlgrrnhrdt@gmail.com>
|
||||
*/
|
||||
class ResqueServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register the service provider.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->registerManager();
|
||||
$this->registerWorkCommand();
|
||||
}
|
||||
|
||||
protected function registerManager()
|
||||
{
|
||||
$this->app->singleton(ResqueManager::class, function ($app) {
|
||||
$config = $app['config']['resque.connection'];
|
||||
$resque = new Resque();
|
||||
$resque->setBackend(implode(':', [$config['host'], $config['port']]), $config['db']);
|
||||
return new ResqueManager($resque);
|
||||
});
|
||||
}
|
||||
|
||||
protected function registerWorkCommand()
|
||||
{
|
||||
$this->app->singleton('command.resque.work', function () {
|
||||
return new WorkCommand();
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue