update lock clucknut
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 14s
Build, Push and Deploy / build-and-push (push) Successful in 3m14s
Build, Push and Deploy / deploy-staging (push) Successful in 25s
Build, Push and Deploy / deploy-production (push) Has been skipped

This commit is contained in:
2026-04-18 20:32:18 +07:00
parent 4554035227
commit dcaf267458
3359 changed files with 153185 additions and 205489 deletions

View File

@@ -33,7 +33,7 @@
"laravel/serializable-closure": "^1.3 || ^2.0",
"phpunit/phpunit": "^9.3 || ^11.4.3",
"spatie/phpunit-snapshot-assertions": "^4.2 || ^5.1.6",
"symfony/var-dumper": "^5.1 || ^6.0 || ^7.0"
"symfony/var-dumper": "^5.1|^6.0|^7.0|^8.0"
},
"minimum-stability": "dev",
"prefer-stable": true,

View File

@@ -262,7 +262,7 @@ protected function isApplicationFrame(string $frameFilename): bool
}
// Edge case for vendor files that typically live in the app code (e.g. Laravel's `artisan` or Statamic's `please`)
if (preg_match('/\/(artisan|please)$/', $relativeFile)) {
if (preg_match('/[\\/\\\\](artisan|please)$/', $relativeFile)) {
return false;
}

View File

@@ -101,7 +101,7 @@ protected function getCodeSnippetProvider(): SnippetProvider
return new LaravelSerializableClosureSnippetProvider($this->textSnippet);
}
if (@file_exists($this->file)) {
if (@is_file($this->file)) {
return new FileSnippetProvider($this->file);
}

View File

@@ -11,12 +11,12 @@
"license": "MIT",
"require": {
"php": "^8.0",
"illuminate/pipeline": "^8.0|^9.0|^10.0|^11.0|^12.0",
"illuminate/pipeline": "^8.0|^9.0|^10.0|^11.0|^12.0|^13.0",
"spatie/backtrace": "^1.6.1",
"symfony/http-foundation": "^5.2|^6.0|^7.0",
"symfony/mime": "^5.2|^6.0|^7.0",
"symfony/process": "^5.2|^6.0|^7.0",
"symfony/var-dumper": "^5.2|^6.0|^7.0"
"symfony/http-foundation": "^5.2|^6.0|^7.0|^8.0",
"symfony/mime": "^5.2|^6.0|^7.0|^8.0",
"symfony/process": "^5.2|^6.0|^7.0|^8.0",
"symfony/var-dumper": "^5.2|^6.0|^7.0|^8.0"
},
"require-dev": {
"dms/phpunit-arraysubset-asserts": "^0.5.0",

0
vendor/spatie/flare-client-php/src/Flare.php vendored Normal file → Executable file
View File

View File

@@ -20,21 +20,24 @@
"php": "^8.0",
"ext-json": "*",
"ext-mbstring": "*",
"spatie/flare-client-php": "^1.7",
"symfony/console": "^5.4|^6.0|^7.0",
"symfony/var-dumper": "^5.4|^6.0|^7.0",
"spatie/error-solutions": "^1.0"
"spatie/backtrace": "^1.7.1",
"spatie/flare-client-php": "^1.9",
"symfony/console": "^5.4.42|^6.0|^7.0|^8.0",
"symfony/http-foundation": "^5.4.42|^6.0|^7.0|^8.0",
"symfony/mime": "^5.4.42|^6.0|^7.0|^8.0",
"symfony/var-dumper": "^5.4.42|^6.0|^7.0|^8.0",
"spatie/error-solutions": "^1.1.2"
},
"require-dev" : {
"illuminate/cache" : "^9.52|^10.0|^11.0|^12.0",
"illuminate/cache" : "^9.52|^10.0|^11.0|^12.0|^13.0",
"mockery/mockery" : "^1.4",
"pestphp/pest" : "^1.20|^2.0",
"pestphp/pest" : "^1.20|^2.0|^3.0",
"phpstan/extension-installer" : "^1.1",
"phpstan/phpstan-deprecation-rules" : "^1.0",
"phpstan/phpstan-phpunit" : "^1.0",
"psr/simple-cache-implementation" : "*",
"symfony/cache" : "^5.4|^6.0|^7.0",
"symfony/process" : "^5.4|^6.0|^7.0",
"symfony/cache" : "^5.4.38|^6.0|^7.0|^8.0",
"symfony/process" : "^5.4.35|^6.0|^7.0|^8.0",
"vlucas/phpdotenv" : "^5.5"
},
"suggest" : {

View File

@@ -219,6 +219,14 @@ protected function getDefaultOptions(): array
'label' => 'NetBeans',
'url' => 'netbeans://open/?f=%path:%line',
],
'zed' => [
'label' => 'Zed',
'url' => 'zed://file/%path:%line',
],
'windsurf' => [
'label' => 'Windsurf',
'url' => 'windsurf://file/%path:%line',
],
'xdebug' => [
'label' => 'Xdebug',
'url' => 'xdebug://%path@%line',

View File

@@ -23,16 +23,17 @@
"homepage": "https://github.com/spatie/laravel-permission",
"require": {
"php": "^8.0",
"illuminate/auth": "^8.12|^9.0|^10.0|^11.0|^12.0",
"illuminate/container": "^8.12|^9.0|^10.0|^11.0|^12.0",
"illuminate/contracts": "^8.12|^9.0|^10.0|^11.0|^12.0",
"illuminate/database": "^8.12|^9.0|^10.0|^11.0|^12.0"
"illuminate/auth": "^8.12|^9.0|^10.0|^11.0|^12.0|^13.0",
"illuminate/container": "^8.12|^9.0|^10.0|^11.0|^12.0|^13.0",
"illuminate/contracts": "^8.12|^9.0|^10.0|^11.0|^12.0|^13.0",
"illuminate/database": "^8.12|^9.0|^10.0|^11.0|^12.0|^13.0"
},
"require-dev": {
"laravel/passport": "^11.0|^12.0",
"laravel/passport": "^11.0|^12.0|^13.0",
"laravel/pint": "^1.0",
"orchestra/testbench": "^6.23|^7.0|^8.0|^9.0|^10.0",
"phpunit/phpunit": "^9.4|^10.1|^11.5"
"orchestra/testbench": "^6.23|^7.0|^8.0|^9.0|^10.0|^11.0",
"pestphp/pest": "^2.0|^3.0|^4.0",
"pestphp/pest-plugin-laravel": "^2.0|^3.0|^4.0"
},
"minimum-stability": "dev",
"prefer-stable": true,
@@ -50,7 +51,10 @@
}
},
"config": {
"sort-packages": true
"sort-packages": true,
"allow-plugins": {
"pestphp/pest-plugin": true
}
},
"extra": {
"branch-alias": {
@@ -64,7 +68,7 @@
}
},
"scripts": {
"test": "phpunit",
"test": "pest",
"format": "pint",
"analyse": "echo 'Checking dependencies...' && composer require --dev larastan/larastan && phpstan analyse"
}

View File

@@ -1,5 +1,9 @@
<?php
use Spatie\Permission\DefaultTeamResolver;
use Spatie\Permission\Models\Permission;
use Spatie\Permission\Models\Role;
return [
'models' => [
@@ -13,7 +17,7 @@
* `Spatie\Permission\Contracts\Permission` contract.
*/
'permission' => Spatie\Permission\Models\Permission::class,
'permission' => Permission::class,
/*
* When using the "HasRoles" trait from this package, we need to know which
@@ -24,7 +28,7 @@
* `Spatie\Permission\Contracts\Role` contract.
*/
'role' => Spatie\Permission\Models\Role::class,
'role' => Role::class,
],
@@ -136,7 +140,7 @@
/*
* The class to use to resolve the permissions team id
*/
'team_resolver' => \Spatie\Permission\DefaultTeamResolver::class,
'team_resolver' => DefaultTeamResolver::class,
/*
* Passport Client Credentials Grant
@@ -183,7 +187,7 @@
* When permissions or roles are updated the cache is flushed automatically.
*/
'expiration_time' => \DateInterval::createFromDateString('24 hours'),
'expiration_time' => DateInterval::createFromDateString('24 hours'),
/*
* The cache key used to store all permissions.

View File

@@ -3,7 +3,9 @@
namespace Spatie\Permission\Commands;
use Illuminate\Console\Command;
use Spatie\Permission\Contracts\Role;
use Spatie\Permission\Contracts\Role as RoleContract;
use Spatie\Permission\PermissionRegistrar;
class AssignRole extends Command
{
@@ -11,17 +13,24 @@ class AssignRole extends Command
{name : The name of the role}
{userId : The ID of the user to assign the role to}
{guard? : The name of the guard}
{userModelNamespace=App\Models\User : The fully qualified class name of the user model}';
{userModelNamespace=App\Models\User : The fully qualified class name of the user model}
{--team-id=}';
protected $description = 'Assign a role to a user. (Note: does not support Teams.)';
protected $description = 'Assign a role to a user';
public function handle()
public function handle(PermissionRegistrar $permissionRegistrar)
{
$roleName = $this->argument('name');
$userId = $this->argument('userId');
$guardName = $this->argument('guard');
$userModelClass = $this->argument('userModelNamespace');
if (! $permissionRegistrar->teams && $this->option('team-id')) {
$this->warn('Teams feature disabled, argument --team-id has no effect. Either enable it in permissions config file or remove --team-id parameter');
return;
}
// Validate that the model class exists and is instantiable
if (! class_exists($userModelClass)) {
$this->error("User model class [{$userModelClass}] does not exist.");
@@ -37,13 +46,18 @@ public function handle()
return Command::FAILURE;
}
/** @var \Spatie\Permission\Contracts\Role $roleClass */
$teamIdAux = getPermissionsTeamId();
setPermissionsTeamId($this->option('team-id') ?: null);
/** @var Role $roleClass */
$roleClass = app(RoleContract::class);
$role = $roleClass::findOrCreate($roleName, $guardName);
$user->assignRole($role);
setPermissionsTeamId($teamIdAux);
$this->info("Role `{$role->name}` assigned to user ID {$userId} successfully.");
return Command::SUCCESS;

View File

@@ -3,6 +3,7 @@
namespace Spatie\Permission\Contracts;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Spatie\Permission\Exceptions\PermissionDoesNotExist;
/**
* @property int|string $id
@@ -24,7 +25,7 @@ public function roles(): BelongsToMany;
* Find a permission by its name.
*
*
* @throws \Spatie\Permission\Exceptions\PermissionDoesNotExist
* @throws PermissionDoesNotExist
*/
public static function findByName(string $name, ?string $guardName): self;
@@ -32,7 +33,7 @@ public static function findByName(string $name, ?string $guardName): self;
* Find a permission by its id.
*
*
* @throws \Spatie\Permission\Exceptions\PermissionDoesNotExist
* @throws PermissionDoesNotExist
*/
public static function findById(int|string $id, ?string $guardName): self;

View File

@@ -2,6 +2,8 @@
namespace Spatie\Permission\Contracts;
use Illuminate\Database\Eloquent\Model;
interface PermissionsTeamResolver
{
public function getPermissionsTeamId(): int|string|null;
@@ -9,7 +11,7 @@ public function getPermissionsTeamId(): int|string|null;
/**
* Set the team id for teams/groups support, this id is used when querying permissions/roles
*
* @param int|string|\Illuminate\Database\Eloquent\Model|null $id
* @param int|string|Model|null $id
*/
public function setPermissionsTeamId($id): void;
}

View File

@@ -3,6 +3,7 @@
namespace Spatie\Permission\Contracts;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Spatie\Permission\Exceptions\RoleDoesNotExist;
/**
* @property int|string $id
@@ -24,7 +25,7 @@ public function permissions(): BelongsToMany;
* Find a role by its name and guard name.
*
*
* @throws \Spatie\Permission\Exceptions\RoleDoesNotExist
* @throws RoleDoesNotExist
*/
public static function findByName(string $name, ?string $guardName): self;
@@ -32,7 +33,7 @@ public static function findByName(string $name, ?string $guardName): self;
* Find a role by its id and guard name.
*
*
* @throws \Spatie\Permission\Exceptions\RoleDoesNotExist
* @throws RoleDoesNotExist
*/
public static function findById(int|string $id, ?string $guardName): self;
@@ -44,7 +45,7 @@ public static function findOrCreate(string $name, ?string $guardName): self;
/**
* Determine if the user may perform the given permission.
*
* @param string|int|\Spatie\Permission\Contracts\Permission|\BackedEnum $permission
* @param string|int|Permission|\BackedEnum $permission
*/
public function hasPermissionTo($permission, ?string $guardName): bool;
}

View File

@@ -2,6 +2,7 @@
namespace Spatie\Permission;
use Illuminate\Database\Eloquent\Model;
use Spatie\Permission\Contracts\PermissionsTeamResolver;
class DefaultTeamResolver implements PermissionsTeamResolver
@@ -11,11 +12,11 @@ class DefaultTeamResolver implements PermissionsTeamResolver
/**
* Set the team id for teams/groups support, this id is used when querying permissions/roles
*
* @param int|string|\Illuminate\Database\Eloquent\Model|null $id
* @param int|string|Model|null $id
*/
public function setPermissionsTeamId($id): void
{
if ($id instanceof \Illuminate\Database\Eloquent\Model) {
if ($id instanceof Model) {
$id = $id->getKey();
}
$this->teamId = $id;

View File

@@ -5,6 +5,7 @@
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Support\Carbon;
use Spatie\Permission\Contracts\Permission as PermissionContract;
use Spatie\Permission\Exceptions\PermissionAlreadyExists;
use Spatie\Permission\Exceptions\PermissionDoesNotExist;
@@ -14,8 +15,8 @@
use Spatie\Permission\Traits\RefreshesPermissionCache;
/**
* @property ?\Illuminate\Support\Carbon $created_at
* @property ?\Illuminate\Support\Carbon $updated_at
* @property ?Carbon $created_at
* @property ?Carbon $updated_at
*/
class Permission extends Model implements PermissionContract
{

View File

@@ -4,6 +4,8 @@
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Support\Carbon;
use Spatie\Permission\Contracts\Permission;
use Spatie\Permission\Contracts\Role as RoleContract;
use Spatie\Permission\Exceptions\GuardDoesNotMatch;
use Spatie\Permission\Exceptions\PermissionDoesNotExist;
@@ -15,8 +17,8 @@
use Spatie\Permission\Traits\RefreshesPermissionCache;
/**
* @property ?\Illuminate\Support\Carbon $created_at
* @property ?\Illuminate\Support\Carbon $updated_at
* @property ?Carbon $created_at
* @property ?Carbon $updated_at
*/
class Role extends Model implements RoleContract
{
@@ -188,7 +190,7 @@ protected static function findByParam(array $params = []): ?RoleContract
/**
* Determine if the role may perform the given permission.
*
* @param string|int|\Spatie\Permission\Contracts\Permission|\BackedEnum $permission
* @param string|int|Permission|\BackedEnum $permission
*
* @throws PermissionDoesNotExist|GuardDoesNotMatch
*/

View File

@@ -101,7 +101,7 @@ protected function getCacheStoreFromConfig(): Repository
/**
* Set the team id for teams/groups support, this id is used when querying permissions/roles
*
* @param int|string|\Illuminate\Database\Eloquent\Model|null $id
* @param int|string|Model|null $id
*/
public function setPermissionsTeamId($id): void
{

View File

@@ -13,6 +13,7 @@
use Illuminate\Support\Collection;
use Illuminate\Support\ServiceProvider;
use Illuminate\View\Compilers\BladeCompiler;
use Laravel\Octane\Contracts\OperationTerminated;
use Spatie\Permission\Contracts\Permission as PermissionContract;
use Spatie\Permission\Contracts\Role as RoleContract;
@@ -101,7 +102,7 @@ protected function registerOctaneListener(): void
$dispatcher = $this->app[Dispatcher::class];
// @phpstan-ignore-next-line
$dispatcher->listen(function (\Laravel\Octane\Contracts\OperationTerminated $event) {
$dispatcher->listen(function (OperationTerminated $event) {
// @phpstan-ignore-next-line
$event->sandbox->make(PermissionRegistrar::class)->setPermissionsTeamId(null);
});
@@ -110,7 +111,7 @@ protected function registerOctaneListener(): void
return;
}
// @phpstan-ignore-next-line
$dispatcher->listen(function (\Laravel\Octane\Contracts\OperationTerminated $event) {
$dispatcher->listen(function (OperationTerminated $event) {
// @phpstan-ignore-next-line
$event->sandbox->make(PermissionRegistrar::class)->clearPermissionsCollection();
});

View File

@@ -1,20 +1,24 @@
<?php
use Illuminate\Database\Eloquent\Model;
use Spatie\Permission\Guard;
use Spatie\Permission\PermissionRegistrar;
if (! function_exists('getModelForGuard')) {
function getModelForGuard(string $guard): ?string
{
return Spatie\Permission\Guard::getModelForGuard($guard);
return Guard::getModelForGuard($guard);
}
}
if (! function_exists('setPermissionsTeamId')) {
/**
* @param int|string|null|\Illuminate\Database\Eloquent\Model $id
* @param int|string|null|Model $id
*/
function setPermissionsTeamId($id)
{
app(\Spatie\Permission\PermissionRegistrar::class)->setPermissionsTeamId($id);
app(PermissionRegistrar::class)->setPermissionsTeamId($id);
}
}
@@ -24,6 +28,6 @@ function setPermissionsTeamId($id)
*/
function getPermissionsTeamId()
{
return app(\Spatie\Permission\PermissionRegistrar::class)->getPermissionsTeamId();
return app(PermissionRegistrar::class)->getPermissionsTeamId();
}
}