本文整理汇总了PHP中Queue::getIron方法的典型用法代码示例。如果您正苦于以下问题:PHP Queue::getIron方法的具体用法?PHP Queue::getIron怎么用?PHP Queue::getIron使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Queue
的用法示例。
在下文中一共展示了Queue::getIron方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: boot
public static function boot()
{
parent::boot();
static::created(function ($inbound) {
Pusherer::trigger('boom', 'add_inbound', $inbound);
Queue::getIron()->addSubscriber('moCallback', array('url' => url('queue/receive')));
Queue::push('Inbound@moCallback', $inbound->id, 'moCallback');
});
}
示例2: boot
public static function boot()
{
parent::boot();
static::created(function ($outbound) {
$outbound = Outbound::find($outbound->id);
if ($outbound->type != 'whatsapp') {
Queue::getIron()->addSubscriber('sendMessage', array('url' => url('queue/receive')));
Queue::push('sendMessage', $outbound->id);
}
Pusherer::trigger('boom', 'add_outbound', $outbound);
});
static::updated(function ($outbound) {
Pusherer::trigger('boom', 'update_outbound', $outbound);
});
}
示例3: postSetupNexmo
public function postSetupNexmo()
{
$nexmo_key = Input::get('nexmo_key');
$nexmo_secret = Input::get('nexmo_secret');
$nexmo = new NexmoAccount($nexmo_key, $nexmo_secret);
try {
// check nexmo credentials
$credit_balance = $nexmo->getBalance();
// check db connection
DB::connection()->getDatabaseName();
// migrate db
Artisan::call('migrate');
// truncate number table
DB::table('number')->truncate();
// set nexmo credentials to env
Cache::forever('NEXMO_KEY', $nexmo_key);
Cache::forever('NEXMO_SECRET', $nexmo_secret);
// add numbers to db
$numbers = $nexmo->getInboundNumbers();
if ($numbers['count'] > 0) {
foreach ($numbers['numbers'] as $num) {
$number = new Number();
$number->number = $num['msisdn'];
$number->country_code = $num['country'];
$number->type = $num['type'];
$number->features = $num['features'];
$number->voice_callback_type = $num['voiceCallbackType'];
$number->voice_callback_value = $num['voiceCallbackValue'];
$number->save();
}
}
// set dn callback url
// $nexmo->updateAccountSettings(array('drCallBackUrl' => url('callback/dn')));
Queue::getIron()->addSubscriber('setupDnCallbackUrl', array('url' => url('queue/receive')));
Queue::push('HomeController@setupDnCallbackUrl', array('nexmo_key' => $nexmo_key, 'nexmo_secret' => $nexmo_secret), 'setupDnCallbackUrl');
// set balance to cache
Cache::put('nexmo', $credit_balance, 10);
if (Auth::check()) {
return Redirect::to('/');
}
return Redirect::to('/register');
} catch (Exception $e) {
return Redirect::to('start')->with('message', $e->__toString());
}
}
示例4: boot
public static function boot()
{
parent::boot();
$nexmo = new NexmoAccount(Cache::get('NEXMO_KEY', getenv('NEXMO_KEY')), Cache::get('NEXMO_SECRET', getenv('NEXMO_SECRET')));
static::created(function ($number) use($nexmo) {
Pusherer::trigger('boom', 'add_number', $number);
// set mo and voice callback url
Queue::getIron()->addSubscriber('setupNumberCallbackUrl', array('url' => url('queue/receive')));
Queue::push('Number@setupNumberCallbackUrl', array('nexmo_key' => $nexmo->nexmo_key, 'nexmo_secret' => $nexmo->nexmo_secret, 'country_code' => $number->country_code, 'number' => $number->number), 'setupNumberCallbackUrl');
});
static::updating(function ($number) use($nexmo) {
if ($number->isDirty('voice_callback_type') || $number->isDirty('voice_callback_value')) {
return $nexmo->updateNumber($number->country_code, $number->number, url('callback/mo'), array('voiceCallbackType' => $number->voice_callback_type, 'voiceCallbackValue' => $number->voice_callback_value, 'voiceStatusCallback' => url('callback/voice')));
}
return true;
});
static::deleting(function ($number) use($nexmo) {
return $nexmo->cancelNumber($number->country_code, $number->number);
});
static::deleted(function ($number) {
Pusherer::trigger('boom', 'remove_number', $number);
});
}
示例5: boot
public static function boot()
{
parent::boot();
static::created(function ($outbound_chunk) {
$outbound_id = $outbound_chunk->outbound->id;
// update status outbound
if ($outbound_chunk->status_code > 0 && isset($status_string[(int) $outbound_chunk->status_code])) {
$outbound = Outbound::find($outbound_id);
$outbound->status = strtolower($status_string[(int) $outbound_chunk->status_code]);
$outbound->save();
}
});
static::updated(function ($outbound_chunk) {
$outbound_id = $outbound_chunk->outbound->id;
// update status outbound
if ($outbound_chunk->dn_error_code >= 0) {
$outbound = Outbound::find($outbound_id);
$outbound->status = strtolower($outbound_chunk->dn_status);
$outbound->save();
Queue::getIron()->addSubscriber('dnCallback', array('url' => url('queue/receive')));
Queue::push('OutboundChunk@dnCallback', $outbound_chunk->id, 'dnCallback');
}
});
}
示例6: function
<?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Queue::getIron()->ssl_verifypeer = false;
Route::get('home', function () {
return view('welcome');
});
Route::get('', function () {
return view('welcome');
});
Route::controllers(['auth' => 'Auth\\AuthController', 'password' => 'Auth\\PasswordController']);
Route::post('queue/receive', function () {
return Queue::marshal();
});
Route::get('empresa', 'EmpresaController@indexempresa');
Route::get('cuenta', 'EmpresaController@cuentaempresa');
Route::get('proyectos', 'EmpresaController@proyectosempresa');
Route::post('proyectos/create', 'EmpresaController@createproyecto');
Route::get('contacto', 'EmpresaController@contactoempresa');
Route::get('personal', 'EmpresaController@personalempresa');
Route::post('updatedatos', 'EmpresaController@updatedatos');
Route::get('getpersonal', 'EmpresaController@getpersonalempresa');