Skip to content

Commit

Permalink
Fix default user_name_searchable_columns (#215)
Browse files Browse the repository at this point in the history
Add some missing translation
Add Vietnamese translation
  • Loading branch information
PTKDrake authored Oct 27, 2024
1 parent 2466cf3 commit 160442f
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 2 deletions.
9 changes: 9 additions & 0 deletions resources/lang/en/filament-spatie.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@
'field.roles' => 'Roles',
'field.role' => 'Role',
'field.team' => 'Team',
'field.models' => 'Models',

/*
|--------------------------------------------------------------------------
| Actions
|--------------------------------------------------------------------------
*/

'action.attach_to_roles' => 'Attach to roles',

/*
|--------------------------------------------------------------------------
Expand Down
41 changes: 41 additions & 0 deletions resources/lang/vi/filament-spatie.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

return [
/*
|--------------------------------------------------------------------------
| Fields
|--------------------------------------------------------------------------
*/

'field.guard_name' => 'Tên Bảo Bệ',
'field.permissions_count' => 'Số Quyền',
'field.name' => 'Tên',
'field.permissions' => 'Các Quyền',
'field.roles' => 'Các Vai Trò',
'field.role' => 'Vai Trò',
'field.team' => 'Nhóm',
'field.models' => 'Các Mô Hình',

/*
|--------------------------------------------------------------------------
| Actions
|--------------------------------------------------------------------------
*/

'action.attach_to_roles' => 'Đính kèm vào vai trò',

/*
|--------------------------------------------------------------------------
| Labels
|--------------------------------------------------------------------------
*/

'section.permission' => 'Quyền',
'section.permissions' => 'Các Quyền',
'section.role' => 'Vai Trò',
'section.roles' => 'Các Vai Trò',
'section.roles_and_permissions' => 'Các Vai Trò và Quyền',
'select-team' => 'Lựa Chọn Một Nhóm',
'select-team-hint' => 'Để trống nếu dùng vai trò toàn cục',
'section.users' => 'Các Người Dùng',
];
3 changes: 2 additions & 1 deletion src/Resources/PermissionResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public static function table(Table $table): Table
])
->filters([
SelectFilter::make('models')
->label('Models')
->label(__('filament-spatie-roles-permissions::filament-spatie.field.models'))
->multiple()
->options(function () {
$commands = new \Althinect\FilamentSpatieRolesPermissions\Commands\Permission();
Expand Down Expand Up @@ -170,6 +170,7 @@ public static function table(Table $table): Table
Tables\Actions\DeleteBulkAction::make(),
]),
BulkAction::make('Attach to roles')
->label(__('filament-spatie-roles-permissions::filament-spatie.action.attach_to_roles'))
->action(function (Collection $records, array $data): void {
Role::whereIn('id', $data['roles'])->each(function (Role $role) use ($records): void {
$records->each(fn (Permission $permission) => $role->givePermissionTo($permission));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function table(Table $table): Table
->columns([
TextColumn::make(config('filament-spatie-roles-permissions.user_name_column'))
->label(__('filament-spatie-roles-permissions::filament-spatie.field.name'))
->searchable(config('filament-spatie-roles-permissions.user_name_searchable_columns')),
->searchable(config('filament-spatie-roles-permissions.user_name_searchable_columns', 'name')),
])
->filters([

Expand Down

0 comments on commit 160442f

Please sign in to comment.