Beispiel #1
0
 public static function get_ids($stats)
 {
     if (empty($stats)) {
         return array();
     }
     return BaseParam::with('en_name')->whereHas('en_name', function ($q) use($stats) {
         $q->whereIn('term', $stats);
     })->remember(Config::get('site.cache_length'))->lists('id');
 }
Beispiel #2
0
 public static function get_ids($stats, $preserve_order = false)
 {
     if (empty($stats)) {
         return [];
     }
     if (!$preserve_order) {
         return BaseParam::with('en_name')->whereHas('en_name', function ($q) use($stats) {
             $q->whereIn('term', $stats);
         })->lists('id');
     }
     $results = [];
     foreach ($stats as $stat) {
         $r = BaseParam::with('en_name')->whereHas('en_name', function ($q) use($stat) {
             $q->where('term', $stat);
         })->first();
         $results[] = isset($r->id) ? $r->id : 0;
     }
     return $results;
 }