Пример #1
0
 public static function merge()
 {
     $rows = json_decode(Input::get('rows'));
     if (is_array($rows) && count($rows) > 0) {
         if (count($rows) < 2) {
             return Api::to(array('error', Lang::get('core.mergeerror'))) ?: \Response::json(array('result' => 'error', 'error' => Lang::get('core.mergeerror')));
         }
         $_merge_to = false;
         foreach ($rows as $i => $r) {
             if ($r != Confide::user()->id) {
                 $user = User::find($r);
                 if (!empty($user)) {
                     if (!$_merge_to) {
                         $_merge_to = $user;
                         continue;
                     }
                     $user->merge($user);
                 } else {
                     return Api::to(array('error', '')) ?: \Response::json(array('result' => 'error', 'error' => ''));
                 }
             }
         }
     }
     if (!Api::make(array('success'))) {
         return \Response::json(array('result' => 'success'));
     }
 }
Пример #2
0
 public static function make($file, $data = array())
 {
     return Api::make($data) ?: View::make(self::path($file), $data);
 }