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); }); }
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'); } }); }
/** * Display the specified resource. * * @param int $id * @return Response */ public function show($id) { return Outbound::find($id); }