From c29eaec1c9cc00f85dfc8f1619c05bb98e9a72ae Mon Sep 17 00:00:00 2001 From: A1Gard Date: Tue, 10 Dec 2024 13:58:20 +0330 Subject: [PATCH] fixed ara bug added sub groups function --- app/Helpers/Helper.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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(); +}