Skip to content

Commit

Permalink
fix: $driver type update ?string $driver
Browse files Browse the repository at this point in the history
  • Loading branch information
Tinywan committed Mar 12, 2023
1 parent 79a7b98 commit 49cf201
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/Adapter/DatabaseAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ class DatabaseAdapter implements Adapter, UpdatableAdapter, BatchAdapter, Filter
/**
* @var bool
*/
private $filtered = false;
private bool $filtered = false;

/**
* RuleModel model.
*
* @var RuleModel
*/
protected $model;
protected RuleModel $model;

/**
* the DatabaseAdapter constructor.
Expand Down
6 changes: 3 additions & 3 deletions src/Model/RuleModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ class RuleModel extends Model implements Arrayable
'v5' => 'string'
];

/** @var string $driver */
protected string $driver;
/** @var string|null $driver */
protected ?string $driver;

/**
* 架构函数
Expand All @@ -61,7 +61,7 @@ public function __construct(array $data = [], ?string $driver = null)
*/
protected function config(string $key = null, $default = null)
{
$driver = $this->driver ?? config('plugin.casbin.webman-permission.permission.default');
$driver = $this->driver ?: config('plugin.casbin.webman-permission.permission.default');
return config('plugin.casbin.webman-permission.permission.' . $driver . '.' . $key, $default);
}
}

0 comments on commit 49cf201

Please sign in to comment.