PHP Class App\services\CategoryService

Show file Open project: qloog/laravel5-backend Class Usage Examples

Public Methods

Method Description
getChilds ( $cate, integer $pid ) : array 根据父级分类id获得所有子分类id
getParents ( array $cate, integer $id ) : array 根据一个子分类id获取所有的父级分类 eg: 首页>衣服>女装>外套
unlimitedForLayer ( $cate, string $name = 'child', integer $pid ) : array 组合多维数组
unlimitedForLevel ( array $cate, string $html = '--', integer $pid, integer $level ) : array 组合一维数组

Method Details

getChilds() public static method

根据父级分类id获得所有子分类id
public static getChilds ( $cate, integer $pid ) : array
$cate
$pid integer
return array

getParents() public static method

根据一个子分类id获取所有的父级分类 eg: 首页>衣服>女装>外套
public static getParents ( array $cate, integer $id ) : array
$cate array 分类数组
$id integer 当前分类id
return array

unlimitedForLayer() public static method

组合多维数组
public static unlimitedForLayer ( $cate, string $name = 'child', integer $pid ) : array
$cate
$name string
$pid integer
return array

unlimitedForLevel() public static method

组合一维数组
public static unlimitedForLevel ( array $cate, string $html = '--', integer $pid, integer $level ) : array
$cate array
$html string
$pid integer
$level integer
return array