Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/mcoil.corals.io/app/Http/Controllers/Front/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/mcoil.corals.io/app/Http/Controllers/Front/CategoryController.php
<?php

namespace App\Http\Controllers\Front;

use App\Shop\Categories\Repositories\CategoryRepository;
use App\Shop\Categories\Repositories\Interfaces\CategoryRepositoryInterface;
use App\Http\Controllers\Controller;
use App\Shop\VatDisplaySettings\VatDisplaySetting;
use App\Shop\Pages\Creator;
use App\Shop\Banners\Banner;
use App\Shop\VideoTextBoxes\VideoTextBox;
use App\Shop\TextBoxes\TextBox;
use App\Shop\Categories\Category;
use App\Shop\ServiceBoxes\ServiceBox;
use App\Shop\CalltoAction\CalltoAction;
use App\Shop\Products\Product;


class CategoryController extends Controller {
    /**
     * @var CategoryRepositoryInterface
     */
    private $categoryRepo;

    /**
     * CategoryController constructor.
     *
     * @param CategoryRepositoryInterface $categoryRepository
     */
    public function __construct(CategoryRepositoryInterface $categoryRepository) {
        $this->categoryRepo = $categoryRepository;
    }

    /**
     * Find the category via the slug
     *
     * @param string $slug
     * @return \App\Shop\Categories\Category
     */
    public function getCategory(string $slug) {
        $check_cat = Category::where('slug',$slug)->first();
        $page_details = Creator::where('slug', $slug)->first();
        if ($check_cat) {
            $category = $this->categoryRepo->findCategoryBySlug(['slug' => $slug]);
            $repo = new CategoryRepository($category);
            if (request()->has('q') && request()->input('q') != '') {
                $searchText = request()->input('q');
                $products = $repo->findProducts()->where('status', 1)->where('oil_type_status', 0)->all();
            } else {
                $products = $repo->findProducts()->where('status', 1)->where('oil_type_status', 0)->all();    
            }
            // Vat display setting
            $vatDisplaySetting = VatDisplaySetting::first();
            return view('front.categories.category', [
                'category' => $category,
                'products' => $repo->paginateArrayResults($products, 20),
                'vatDisplaySetting' => $vatDisplaySetting
            ]);    
        } elseif ($page_details) {
            $currentUrl = url()->current();
            $textBox1 = null;
            if ($page_details != null) {
                $modules = json_decode($page_details->modules);
                $banner1 = null;
                if ($modules->banner1) {
                    $banner1 = Banner::find($modules->banner1);    
                }
                $banner2 = null;
                if ($modules->banner2) {
                    $banner2 = Banner::find($modules->banner2);    
                }
                $textBox1 =null;
                if ($modules->text_box1) {
                    $textBox1 = TextBox::find($modules->text_box1);    
                }
                $textBox2 = null;
                if ($modules->text_box2) {
                    $textBox2 = TextBox::find($modules->text_box2);    
                }
                $productServiceBoxes = null;
                if (isset($modules->service_box1)) {
                $productService = ServiceBox::find($modules->service_box1);
                    if ($productService) {
                        $productServiceBoxes = ServiceBox::where('type', $productService->type)->orderBy('orderNO','ASC')->take($page_details->no_of_service_box_display)->get();
                    }    
                }
                $orderStepServiceBoxes = null;
                if (isset($modules->service_box2)) {
                    $orderStepService = ServiceBox::find($modules->service_box2);
                    if ($orderStepService) {
                        $orderStepServiceBoxes = ServiceBox::where('type', $orderStepService->type)->orderBy('orderNO','ASC')->take($page_details->no_of_service_box_display2)->get();
                    }
                }
                $calltoaction = null;
                if ($modules->call_to_action) {
                    $calltoaction = CalltoAction::find($modules->call_to_action);    
                }
            }
            return view('front.page',[ 
                'page_details' => $page_details,
                'banner1' => $banner1,
                'banner2' => $banner2,
                'textBox1' => $textBox1,
                'textBox2' => $textBox2,
                'productServiceBoxes' => $productServiceBoxes,
                'orderStepServiceBoxes' => $orderStepServiceBoxes,
        	    'calltoaction' => $calltoaction
            ]);
        }
    }
}

Spamworldpro Mini