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

Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 

uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/uploads/script/app/Http/Controllers/Admin/   drwxr-xr-x
Free 13.26 GB of 57.97 GB (22.87%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


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

namespace App\Http\Controllers\Admin;

use 
App\Http\Controllers\Controller;
use 
Illuminate\Http\Request;
use 
App\Category;
use 
App\Categorymeta;
use 
Str;
class 
CategoryController extends Controller
{
    
/**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    
public function index(Request $request)
    {
        if (
$request->src) {
           
$posts=Category::withCount('posts')->where('type','category')->where($request->type,$request->src)->latest()->paginate(20);
         }
         else{
            
$posts=Category::withCount('posts')->where('type','category')->latest()->paginate(20);
         }   

       
       return 
view('admin.category.index',compact('posts'));
    } 

    public function 
countries(Request $request)
    {
        if (
$request->src) {
           
$posts=Category::withCount('posts')->where('type','country')->where($request->type,$request->src)->latest()->paginate(20); 
        }
        else{
            
$posts=Category::withCount('posts')->where('type','country')->latest()->paginate(20);
        }
       
       return 
view('admin.location.country.index',compact('posts'));
    }
    public function 
countryCreate()
    {
        return 
view('admin.location.country.create');
    }

    public function 
cities(Request $request)
    {
        if (
$request->src) {
          
$posts=Category::withCount('posts')->where('type','city')->where($request->type,$request->src)->latest()->paginate(20);
        }
        else{
          
$posts=Category::withCount('posts')->where('type','city')->latest()->paginate(20);
        }
       
       return 
view('admin.location.city.index',compact('posts'));
    }
    public function 
cityCreate()
    {
        return 
view('admin.location.city.create');
    }

   


    
/**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    
public function create()
    {
        return 
view('admin.category.create');
    }

    
/**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    
public function store(Request $request)
    {
        
        
$validatedData $request->validate([
        
'name' => 'required|unique:categories|max:100',
        
'file' => 'image|max:1000',
        ]);
        
$slug=Str::slug($request->name);
        if (empty(
$slug)) {
            
$slug=Category::max('id')+1;
        }
         
        
$post= new Category;
        
$post->name=$request->name;
        
$post->slug=$slug;
        if (
$request->file) {
            
$imageName date('dmy').time().'.'.request()->file->getClientOriginalExtension();
            
request()->file->move('uploads/admin/1/'.date('y/m'), $imageName);
            
$post->avatar='uploads/admin/1/'.date('y/m').'/'.$imageName;
        }
        
        
$post->type=$request->type;
        if (
$request->p_id) {
           
$post->p_id=$request->p_id;
        }
        
        
$post->featured=$request->featured;
        
$post->save();

        if (
$request->type=='country' || $request->type=='city') {
          
$data['latitude']=$request->latitude;
          
$data['longitude']=$request->longitude;
          
$data['zoom']=$request->zoom;
          
$meta=new Categorymeta;
          
$meta->type='mapinfo';
          
$meta->category_id=$post->id;
          
$meta->content=json_encode($data);
          
$meta->save();

        }
        return 
response()->json([$request->type.' Created']);
    }

    
/**
     * Display the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    
public function show($id)
    {
        
//
    
}

    
/**
     * Show the form for editing the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    
public function edit($id)
    {
         
$info=Category::with('map')->find($id);
         if (
$info->type=='country') {
            
$map=json_decode($info->map->content);
           return 
view('admin.location.country.edit',compact('info','map'));
         }
         elseif(
$info->type=='city'){
             
$map=json_decode($info->map->content);
             return 
view('admin.location.city.edit',compact('info','map'));
         }
         elseif(
$info->type=='category'){
            return 
view('admin.category.edit',compact('info'));
         }
         
//return view('admin.category.edit',compact('info'));
    
}

    
/**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    
public function update(Request $request$id)
    {
        
$validatedData $request->validate([
        
'name' => 'required|max:100',
        
'slug' => 'required|max:100',
        
'file' => 'image|max:1000',
        ]);

        
$postCategory::find($id);
        
$post->name=$request->name;
        
$post->slug=$request->slug;
        if (
$request->file) {
            
$imageName date('dmy').time().'.'.request()->file->getClientOriginalExtension();
            
request()->file->move('uploads/'.date('y/m'), $imageName);
            if (
file_exists($post->avatar)) {
               
unlink($post->avatar);
            }
            
$post->avatar='uploads/'.date('y/m').'/'.$imageName;
        }
        
        
$post->p_id=$request->p_id;
        
$post->featured=$request->featured;
        
$post->save();

        if (
$post->type=='country' || $post->type=='city') {
          
$data['latitude']=$request->latitude;
          
$data['longitude']=$request->longitude;
          
$data['zoom']=$request->zoom;
          
$metaCategorymeta::where('type','mapinfo')->where('category_id',$post->id)->first();
          if (!empty(
$meta)) {
         
          
$meta->content=json_encode($data);
          
$meta->save();
           }

        }

        return 
response()->json([$post->type.' Updated']);
    }

    
/**
     * Remove the specified resource from storage.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    
public function destroy(Request $request)
    {
        
        if (
$request->type == "delete") {
           foreach (
$request->ids as $row) {
                
$category=Category::with('preview')->find($row);
                if (!empty(
$category->preview->content)) {
                    if (
file_exists($category->preview->content)) {
                        
unlink($category->preview->content);
                    }
                }
                
                
$category->delete();
           }
        }

        return 
response()->json(['Success']);
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

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

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