Skip to content

Commit

Permalink
Fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperDJ authored and github-actions[bot] committed Jul 19, 2023
1 parent 1aad9c6 commit 446b968
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/ClientService.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public static function getClient(string $bearerToken)
public static function getClientPermissions($client): array
{
$permissions = $client->permissions->pluck('name')->toArray();
foreach($client->roles as $role) {
foreach ($client->roles as $role) {
$permissions = array_merge($permissions, $role->permissions->pluck('name')->toArray());
}

Expand Down
2 changes: 1 addition & 1 deletion src/Middlewares/PermissionMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function handle($request, Closure $next, $permission, $guard = null)
$client = ClientService::getClient($bearerToken);
$assignedPermissions = ClientService::getClientPermissions($client);

foreach($permissions as $permission) {
foreach ($permissions as $permission) {
if (in_array($permission, $assignedPermissions)) {
return $next($request);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Middlewares/RoleMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function handle($request, Closure $next, $role, $guard = null)
$client = ClientService::getClient($bearerToken);
$assignedRoles = ClientService::getClientRoles($client);

foreach($roles as $role) {
foreach ($roles as $role) {
if (in_array($role, $assignedRoles)) {
return $next($request);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Middlewares/RoleOrPermissionMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function handle($request, Closure $next, $roleOrPermission, $guard = null
$assignedPermissions = ClientService::getClientPermissions($client);
$assignedRolesAndPermissions = array_merge($assignedRoles, $assignedPermissions);

foreach($rolesOrPermissions as $roleOrPermission) {
foreach ($rolesOrPermissions as $roleOrPermission) {
if (in_array($roleOrPermission, $assignedRolesAndPermissions)) {
return $next($request);
}
Expand Down
7 changes: 5 additions & 2 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\Schema;
use Spatie\Permission\Tests\TestModels\Client;
use Laravel\Passport\PassportServiceProvider;
use Orchestra\Testbench\TestCase as Orchestra;
use Spatie\Permission\Contracts\Permission;
Expand All @@ -17,6 +16,7 @@
use Spatie\Permission\PermissionRegistrar;
use Spatie\Permission\PermissionServiceProvider;
use Spatie\Permission\Tests\TestModels\Admin;
use Spatie\Permission\Tests\TestModels\Client;
use Spatie\Permission\Tests\TestModels\User;

abstract class TestCase extends Orchestra
Expand Down Expand Up @@ -48,8 +48,11 @@ abstract class TestCase extends Orchestra
protected static $migration;

protected static $customMigration;

protected Client $testClient;

protected \Spatie\Permission\Models\Permission $testClientPermission;

protected \Spatie\Permission\Models\Role $testClientRole;

protected function setUp(): void
Expand Down Expand Up @@ -80,7 +83,7 @@ protected function getPackageProviders($app)
{
return [
PermissionServiceProvider::class,
PassportServiceProvider::class
PassportServiceProvider::class,
];
}

Expand Down

0 comments on commit 446b968

Please sign in to comment.