diff --git a/app/Helpers/Helper.php b/app/Helpers/Helper.php index 4b70c80..3a3c82e 100644 --- a/app/Helpers/Helper.php +++ b/app/Helpers/Helper.php @@ -1441,3 +1441,18 @@ function getMainCategory($limit=4,$orderBy = 'sort', $asc = 'ASC') { return \App\Models\Category::whereNull('parent_id')->limit($limit)->orderBy($orderBy,$asc)->get(); } + + +/** + * get group's posts by setting key + * @param $key + * @param integer $limit + * @param string $order + * @param string $dir + * @return \App\Models\Post[]|\Illuminate\Database\Eloquent\Collection|\LaravelIdea\Helper\App\Models\_IH_Post_C + */ +function getSubGroupSetting($key, $limit = 10, $order = 'id', $dir = "DESC") +{ + return Group::where('id', getSetting($key) ?? 1)->first() + ->children()->orderBy($order, $dir)->limit($limit)->get(); +}