Skip to content

Commit

Permalink
Merge pull request #21 from CodeWithDennis/enhance-translatables
Browse files Browse the repository at this point in the history
Extending translatable labels and adding plural label support
  • Loading branch information
Jehizkia authored Sep 18, 2023
2 parents 64396ff + 173fbed commit 85bdd4c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
1 change: 1 addition & 0 deletions config/resource-lock.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
'manager' => [
'navigation_badge' => false,
'navigation_label' => 'Resource Lock Manager',
'plural_label' => 'Resource Locks',
'navigation_group' => 'Settings',
'navigation_sort' => 1,
'limited_access' => false,
Expand Down
19 changes: 12 additions & 7 deletions src/Resources/ResourceLockResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ public static function getModel(): string
{
return config('resource-lock.models.ResourceLock', ResourceLock::class);
}

public static function getPluralLabel(): string
{
return __(config('resource-lock.manager.plural_label', 'Resource Locks'));
}

public static function form(Form $form): Form
{
Expand All @@ -32,13 +37,13 @@ public static function table(Table $table): Tables\Table
{
return $table
->columns([
TextColumn::make('id')->label('Lock ID'),
TextColumn::make('user.id')->label('User ID'),
TextColumn::make('lockable.id')->label('Lockable ID'),
TextColumn::make('lockable_type'),
TextColumn::make('created_at'),
TextColumn::make('updated_at'),
TextColumn::make('updated_at')->label('Expired')
TextColumn::make('id')->label(__('Lock ID')),
TextColumn::make('user.id')->label(__('User ID')),
TextColumn::make('lockable.id')->label(__('Lockable ID')),
TextColumn::make('lockable_type')->label(__('Lockable type')),
TextColumn::make('created_at')->label(__('Created at')),
TextColumn::make('updated_at')->label(__('Updated at')),
TextColumn::make('updated_at')->label(__('Expired'))
->badge()
->color(static function ($record): string {
if ($record->isExpired()) {
Expand Down

0 comments on commit 85bdd4c

Please sign in to comment.