Пример #1
0
 /**
  * 格式化表单校验消息
  *
  * @param  array $messages 未格式化之前数组
  * @return string 格式化之后字符串
  */
 public static function format_message(\Eloquent $messages)
 {
     $reason = ' ';
     foreach ($messages->all('<span class="text_error">:message</span>') as $message) {
         $reason .= $message . ' ';
     }
     return $reason;
 }
Пример #2
0
 static function all($ids = null, $columns = '*')
 {
     if (head((array) $columns) !== '*') {
         return parent::all($ids, $columns);
     } elseif (!$ids) {
         return static::cacheAll(parent::all($ids));
     } else {
         $cached = $new = array();
         foreach (arrize($ids) as $id) {
             ($model = static::cached($id)) ? $cached[] = $model : ($new[] = $id);
         }
         $new and $new = static::cacheAll(parent::all($new));
         return array_merge($cached, $new);
     }
 }