示例#1
0
 public function store()
 {
     $dst = \Input::get('destination');
     $msg = \Input::get('message');
     $schedule = \Input::has('schedule') ? \Input::get('schedule') : null;
     if (\Input::get('state') == 0) {
         $e = array_map('trim', explode(',', $dst));
         foreach ($e as $key) {
             if ($key) {
                 $contact = Contact::where('Name', '=', $key)->first();
                 $group = Group::where('Name', '=', $key)->first();
                 if ($contact) {
                     return Outbox::create(['DestinationNumber' => $contact['Number'], 'SendingDateTime' => $schedule, 'TextDecoded' => $msg, 'CreatorID' => 'users.' . \Auth::user()->id]);
                 } else {
                     if ($group) {
                         return Outbox::SendToGroup($group->Name, $msg, $schedule);
                     } else {
                         return Outbox::create(['DestinationNumber' => $key, 'SendingDateTime' => $schedule, 'TextDecoded' => $msg, 'CreatorID' => 'users.' . \Auth::user()->id]);
                     }
                 }
             }
         }
     } else {
         return Outbox::create(['DestinationNumber' => $dst, 'TextDecoded' => $msg, 'CreatorID' => 'users.' . \Auth::user()->id]);
     }
 }
示例#2
0
 public function update($id)
 {
     $db = Group::find($id);
     $db->Name = \Input::get('name');
     $db->save();
     return \Response::json(['id' => $db->ID]);
 }
示例#3
0
 public function update($id)
 {
     $db = Keyword::find($id);
     $db->name = \Input::get('name');
     $db->keyword = \Input::get('keyword');
     $db->url = \Input::get('url');
     if (\Input::has('gname')) {
         $dbgroup = Group::firstOrCreate(['Name' => \Input::get('gname')]);
         $joingroup_id = $dbgroup->ID;
     } else {
         $joingroup_id = '';
     }
     $db->joingroup_id = $joingroup_id;
     $db->text_reply = \Input::get('text_reply');
     $db->save();
     return \Response::json(['id' => $db->id]);
 }
示例#4
0
 public function update($id)
 {
     $db = Contact::find($id);
     $db->Name = \Input::get('name');
     $db->Number = \Input::get('number');
     if (\Input::has('group')) {
         $dbgroup = Group::firstOrCreate(['Name' => \Input::get('group')]);
         $db->GroupID = $dbgroup->ID;
     } else {
         $db->GroupID = '-1';
     }
     $db->save();
     return \Response::json(['id' => $db->ID]);
 }