| Server IP : 162.214.74.102 / Your IP : 216.73.217.80 Web Server : Apache System : Linux dedi-4363141.lrsys.com.br 3.10.0-1160.119.1.el7.tuxcare.els25.x86_64 #1 SMP Wed Oct 1 17:37:27 UTC 2025 x86_64 User : lrsys ( 1015) PHP Version : 5.6.40 Disable Function : exec,passthru,shell_exec,system MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/lrsys/www/lrsys_apps/dialogo/application/autoload/ |
Upload File : |
<?php
Class ProductCategory {
//retorna todas as categorias ordenadas pela categoria pai e filhas
public static function all() {
return ORM::for_table('sys_items_category')
->table_alias('c')
->select('c.*')
->select('cp.name','name_parent')
->select_expr("(select count(sic.id) from sys_items_category sic where sic.parent=c.id )",'total_filhas')
->select_expr('case when c.parent is null then c.name else concat(cp.name,"",c.name) end as name_ordem')
->left_outer_join('sys_items_category', array('cp.id', '=', 'c.parent'), 'cp')
->order_by_asc('name_ordem')
->find_array();
}
//retorna todas as categorias pai
public static function allParent() {
return ORM::for_table('sys_items_category')->where_null('parent')->order_by_asc('name')->find_many();
}
}