public function index() { if (isset($_REQUEST['url'])) { if (self::OUTBOUND_LOG_URLS) { $outbound = new Outbound($_REQUEST); $outbound->gate = @$_SERVER['HTTP_REFERER']; $outbound->save(); } $this->redirect_to($_REQUEST['url']); } $this->redirect_to(array('controller' => 'home')); }
public function postReply() { $inbound = Inbound::findOrFail(Input::get('inbound_id')); $text = trim(Input::get('text')); if ($text == "") { return array('error' => 'Text is empty'); } $outbound = new Outbound(); $outbound->from = $inbound->to; $outbound->to = $inbound->from; $outbound->text = Input::get('text'); $outbound->type = $inbound->type; $outbound->save(); return ['status' => 'success']; }
/** * Store a newly created resource in storage. * * @return Response */ public function store() { $text = trim(Input::get('text')); if ($text == "") { return array('error' => 'Text is empty'); } $to = Input::get('to'); $senders = preg_split('/[,;\\\\n\\/]/', $to); $ids = array(); foreach ($senders as $sender) { if (trim($sender) == "") { continue; } $outbound = new Outbound(); $outbound->from = Input::get('from'); $outbound->to = str_replace(array('+', '-', ' ', '(', ')'), '', $sender); $outbound->text = $text; $outbound->save(); $ids[] = $outbound->id; } return Outbound::whereIn('id', $ids)->get(); }