Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Actions/StorePermission.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ public function __construct(
}

/**
* Handle storing a permission
* Handle storing a permission.
*/
public function handle(BackedEnum|string $permission, string $guard): void
{
if ($permission instanceof BackedEnum) {
$permission = $permission->value;
$permission = $permission->value;
}

$this->permission::findOrCreate($permission, $guard);
Expand Down
2 changes: 1 addition & 1 deletion src/Actions/SyncDefinedRole.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function __construct(
}

/**
* Handle syncing a defined role
* Handle syncing a defined role.
*/
public function handle(string $name, string $guard, array $permissions): void
{
Expand Down
8 changes: 4 additions & 4 deletions src/Commands/RbacResetCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ class RbacResetCommand extends Command
*/
public function handle(): int
{
if (! $this->databaseReady()) {
if (!$this->databaseReady()) {
$this->error('DB is not ready. Please run migrations.');

return self::INVALID;
}

$this->jobs()->each(function(string $job) {
$this->jobs()->each(function (string $job) {
$this->components->task(
$job,
fn() => $this->laravel->make($job)->dispatchSync()
fn () => $this->laravel->make($job)->dispatchSync()
);
});

Expand All @@ -61,7 +61,7 @@ protected function databaseReady(): bool
$tables = config('permission.table_names', []);

return collect($tables)
->map(fn(string $table) => Schema::hasTable($table))
->map(fn (string $table) => Schema::hasTable($table))
->reject()
->isEmpty();
}
Expand Down
2 changes: 1 addition & 1 deletion src/Jobs/ResetPermissions.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class ResetPermissions
/**
* @param string|null $guard
*/
public function __construct(string $guard = null)
public function __construct(?string $guard = null)
{
$this->guard = $guard ?? config('auth.defaults.guard');
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Actions/StorePermissionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public function it_will_handle_creating_permission(): void
StorePermission::run(FooAbility::One, 'web');

$this->assertDatabaseHas(config('permission.table_names.permissions'), [
'name' => 'una',
'name' => 'una',
'guard_name' => 'web',
]);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Actions/SyncDefinedRoleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function it_will_defer_syncing_defined_role_to_artisan(): void
]);

$this->assertDatabaseHas(config('permission.table_names.roles'), [
'name' => 'foo role',
'name' => 'foo role',
'guard_name' => 'web',
]);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Commands/RbacResetCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function it_will_not_dispatch_if_not_migrated(): void
$this->app['config']->set([
'permission.table_names' => ['permissions' => 'foo'],
]);

Schema::expects('hasTable')
->with('foo')
->andReturnFalse();
Expand Down
10 changes: 5 additions & 5 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
class TestCase extends Orchestra
{
/**
* Get the package providers fopr registrations
* Get the package providers fopr registrations.
*
* @param \Illuminate\Foundation\Application $app
*/
Expand All @@ -23,16 +23,16 @@ protected function getPackageProviders($app): array
}

/**
* Define the environment
* Define the environment.
*/
protected function defineEnvironment($app): void
{
tap($app['config'], function (Repository $config) {
$config->set('database.default', 'sqlite');
$config->set('database.connections.sqlite', [
'driver' => 'sqlite',
'database' => ':memory:',
'prefix' => '',
'driver' => 'sqlite',
'database' => ':memory:',
'prefix' => '',
]);
});

Expand Down
Loading