limit(9)->get(); $count = Template::count(); return [$templates, ['count' => $count]]; } public function getTemplateCategory() { $categories = Template::distinct()->get(['category']); return $categories; } public function getTemplateByCategory(Request $request) { $category = $request->get('category'); if(!$category || $category == 'All') { $templates = Template::orderBy('id', 'DESC')->limit(9)->get(); $count = Template::count(); } else { $templates = Template::where('category', $category)->orderBy('id', 'DESC')->limit(9)->get(); $count = Template::where('category', $category)->count(); } return [$templates, ['count' => $count]]; } public function loadMoreTemplate(Request $request) { $category = $request->get('category'); $last_id = $request->get('last_id'); if($category == 'All') { $templates = Template::select('id','name', 'slug', 'image', 'link_demo')->where('id', '<' , $last_id)->limit(9)->orderBy('id', 'desc')->get(); $count = Template::where('id', '<' , $last_id)->limit(9)->count(); } else { $templates = Template::select('id','name', 'slug', 'image', 'link_demo')->where([['id', '<' , $last_id],['category', $category]])->limit(9)->orderBy('id', 'desc')->get(); $count = Template::where([['id', '<' , $last_id],['category', $category]])->limit(9)->count(); } return [$templates, ['count' => $count]]; } public function getTemplateName(Request $request) { $id = $request->get('id'); return Template::findOrFail($id)->name; } public function getEmkaPricing() { $pricing = Whmcs::GetProducts([ 'gid' => 14 ])['products']['product']; $basic = $pricing[5]; $medium = $pricing[6]; $professional = $pricing[7]; $monthly = EmkaPagePricing::where('period','monthly')->first(); $yearly = EmkaPagePricing::where('period','yearly')->first(); return [ 'whmcs_pricing' => [ 'basic' => $basic, 'medium' => $medium, 'professional' => $professional ], 'content' => [ 'monthly' => $monthly, 'yearly' => $yearly ] ]; } }