Skip to content
Open
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
22 changes: 12 additions & 10 deletions database/migrations/2025_01_23_065140_create_permission_tables.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public function up(): void
});

Schema::create($tableNames['model_has_permissions'], static function (Blueprint $table) use ($tableNames, $columnNames, $pivotPermission, $teams) {
$table->id();
$table->unsignedBigInteger($pivotPermission);

$table->string('model_type');
Expand All @@ -63,19 +64,20 @@ public function up(): void
->on($tableNames['permissions'])
->onDelete('cascade');
if ($teams) {
$table->unsignedBigInteger($columnNames['team_foreign_key']);
$table->unsignedBigInteger($columnNames['team_foreign_key'])->nullable();
$table->index($columnNames['team_foreign_key'], 'model_has_permissions_team_foreign_key_index');

$table->primary([$columnNames['team_foreign_key'], $pivotPermission, $columnNames['model_morph_key'], 'model_type'],
'model_has_permissions_permission_model_type_primary');
$table->unique([$columnNames['team_foreign_key'], $pivotPermission, $columnNames['model_morph_key'], 'model_type'],
'model_has_permissions_unique_constraint');
} else {
$table->primary([$pivotPermission, $columnNames['model_morph_key'], 'model_type'],
'model_has_permissions_permission_model_type_primary');
$table->unique([$pivotPermission, $columnNames['model_morph_key'], 'model_type'],
'model_has_permissions_permission_model_type_unique');
}

});

Schema::create($tableNames['model_has_roles'], static function (Blueprint $table) use ($tableNames, $columnNames, $pivotRole, $teams) {
$table->id();
$table->unsignedBigInteger($pivotRole);

$table->string('model_type');
Expand All @@ -87,14 +89,14 @@ public function up(): void
->on($tableNames['roles'])
->onDelete('cascade');
if ($teams) {
$table->unsignedBigInteger($columnNames['team_foreign_key']);
$table->unsignedBigInteger($columnNames['team_foreign_key'])->nullable();
$table->index($columnNames['team_foreign_key'], 'model_has_roles_team_foreign_key_index');

$table->primary([$columnNames['team_foreign_key'], $pivotRole, $columnNames['model_morph_key'], 'model_type'],
'model_has_roles_role_model_type_primary');
$table->unique([$columnNames['team_foreign_key'], $pivotRole, $columnNames['model_morph_key'], 'model_type'],
'model_has_roles_unique_constraint');
} else {
$table->primary([$pivotRole, $columnNames['model_morph_key'], 'model_type'],
'model_has_roles_role_model_type_primary');
$table->unique([$pivotRole, $columnNames['model_morph_key'], 'model_type'],
'model_has_roles_role_model_type_unique');
}
});

Expand Down
4 changes: 2 additions & 2 deletions resources/lang/vendor/filament-shield/en/filament-shield.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

'column.name' => 'Name',
'column.guard_name' => 'Guard Name',
'column.team' => 'Team',
'column.team' => 'Site',
'column.roles' => 'Roles',
'column.permissions' => 'Permissions',
'column.updated_at' => 'Updated At',
Expand All @@ -24,7 +24,7 @@
'field.guard_name' => 'Guard Name',
'field.permissions' => 'Permissions',
'field.team' => 'Site',
'field.team.placeholder' => 'Select a site ...',
'field.team.placeholder' => 'Global (all sites)',
'field.select_all.name' => 'Select All',
'field.select_all.message' => 'Enables/Disables all Permissions for this role',

Expand Down
15 changes: 15 additions & 0 deletions src/EclipseServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
use Eclipse\Core\Providers\HorizonServiceProvider;
use Eclipse\Core\Providers\TelescopeServiceProvider;
use Eclipse\Core\Services\Registry;
use Filament\Forms\Components\Field;
use Filament\Infolists\Components\Entry;
use Filament\Resources\Resource;
use Filament\Tables\Columns\Column;
use Illuminate\Auth\Events\Login;
Expand Down Expand Up @@ -132,9 +134,22 @@ public function boot(): void
// Register policies for classes that can't be guessed automatically
Gate::policy(Role::class, RolePolicy::class);

// Set common settings for Filament form
Field::configureUsing(function (Field $field) {
$field
->translateLabel();
});

// Set common settings for Filament infolist
Entry::configureUsing(function (Entry $entry) {
$entry
->translateLabel();
});

// Set common settings for Filament table columns
Column::configureUsing(function (Column $column) {
$column
->translateLabel()
->toggleable()
->sortable();
});
Expand Down
Loading