Пример #1
0
 public static function listOfCategory($val)
 {
     $query = PartsCategory::select('id', 'parts_category');
     if (strlen(trim($val)) > 0) {
         $query = $query->where('parts_category', 'LIKE', '%' . str_replace(' ', '%', $val) . '%');
     }
     $query = $query->orderBy('parts_category')->get();
     return $query;
 }
 public function listBox()
 {
     $f = Input::get('f');
     // Meklēšanas parametir
     $s = Input::get('s');
     // Atzīmētās kat. ID
     $listOfCategory = PartsCategory::listOfCategory($f);
     $echoList = '';
     foreach ($listOfCategory as $item) {
         $class = '';
         if ($s == $item->id) {
             $class = 'selected';
         }
         $echoList .= '<div class="item ' . $class . '" id="mdCategoryList_i_' . $item->id . '" onclick="fnClickCategoryList(' . $item->id . ')">' . $item->parts_category . '</div>';
     }
     if (strlen($echoList) == 0) {
         $echoList = '<div class="item">-- nekas nav atrasts --</div>';
     }
     return $echoList;
 }