You've already forked Atomcms-edit
Initial commit
This commit is contained in:
+29
@@ -0,0 +1,29 @@
|
||||
<?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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user