You've already forked Atomcms-edit
30 lines
729 B
PHP
Executable File
30 lines
729 B
PHP
Executable File
<?php
|
|
|
|
namespace App\Services\Emulator\Concerns;
|
|
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
trait HasPermissionColumns
|
|
{
|
|
protected function getPermissionColumnsFromSchema(): array
|
|
{
|
|
if (! Schema::hasTable('permissions')) {
|
|
return [];
|
|
}
|
|
|
|
$columns = Schema::getColumns('permissions');
|
|
|
|
return collect($columns)->filter(function (array $column) {
|
|
$columnName = $column['name'] ?? null;
|
|
|
|
if (! $columnName) {
|
|
return false;
|
|
}
|
|
|
|
return str_starts_with($columnName, 'cmd')
|
|
|| str_starts_with($columnName, 'acc')
|
|
|| str_ends_with($columnName, 'cmd');
|
|
})->values()->toArray();
|
|
}
|
|
}
|