Server : Apache System : Linux host44.registrar-servers.com 4.18.0-513.18.1.lve.2.el8.x86_64 #1 SMP Sat Mar 30 15:36:11 UTC 2024 x86_64 User : vapecompany ( 2719) PHP Version : 7.4.33 Disable Function : NONE Directory : /home/vapecompany/demo.vapecompany.com.bd/app/Http/Controllers/Frontend/ |
Upload File : |
<?php namespace App\Http\Controllers\Frontend; use App\Http\Controllers\Controller; use Illuminate\Http\Request; use App\Models\Service; use App\Models\Category; use App\Models\Product; class HomeController extends Controller { // function __construct(){ // $this->middleware('guest:web'); // } /** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { // $c=Category::get(); // dd($c[0]->submenu()[1]->submenu()->count()); $premium_products = Category::with(['product', 'child.product', 'child.child.product'])->where('category_id', 1)->take(8)->get(); $automizer_products = Category::with(['product', 'child.product', 'child.child.product'])->where('category_id', 7)->take(8)->get(); $coil_products = Category::with(['product', 'child.product', 'child.child.product'])->where('category_id', 9)->take(8)->get(); // $automizer_products=Product::orderBy('product_id', 'desc')->where('category_id',7)->get(); // $coil_products=Product::orderBy('product_id', 'desc')->where('category_id',9)->get(); $premium_e = Category::with("child")->where('category_id',1)->first(); $atomizer = Category::with("child")->where('category_id',7)->first(); $coil = Category::with("child")->where('category_id',9)->first(); $data = [ 'premium_products' => $premium_products, 'automizer_products' => $automizer_products, 'coil_products' => $coil_products, 'premium_e' => $premium_e, 'coil' => $coil, 'atomizer' => $atomizer, ]; return view('frontend.pages.index', $data); } }