Skip to content

Commit 536aa56

Browse files
Fix bug
1 parent 953fc77 commit 536aa56

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

resources/views/export.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class="data-synchronize-export-form"
1616
{{ $exporter->getHeading() }}
1717
</x-core::card.title>
1818
<x-core::card.subtitle class="ms-3">
19-
{{ trans('packages/data-synchronize::data-synchronize.export.form.total', ['total' => $exporter->getTotal(), 'name' => $exporter->label()]) }}
19+
{{ trans('packages/data-synchronize::data-synchronize.export.form.total', ['total' => $exporter->getTotal(), 'name' => $exporter->getLabel()]) }}
2020
</x-core::card.subtitle>
2121
</x-core::card.header>
2222
@endif

src/Exporter/Exporter.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,14 @@ abstract class Exporter implements FromCollection, ShouldAutoSize, WithColumnFor
3434
*/
3535
abstract public function columns(): array;
3636

37-
abstract public function label(): string;
38-
3937
public function getLabel(): string
4038
{
41-
return apply_filters('data_synchronize_exporter_label', $this->label());
39+
return str(static::class)
40+
->afterLast('\\')
41+
->snake()
42+
->replace('_', ' ')
43+
->remove('exporter')
44+
->title();
4245
}
4346

4447
public function getTotal(): int
@@ -50,7 +53,7 @@ public function getHeading(): string
5053
{
5154
return trans(
5255
'packages/data-synchronize::data-synchronize.export.heading',
53-
['label' => $this->label()]
56+
['label' => $this->getLabel()]
5457
);
5558
}
5659

@@ -149,7 +152,7 @@ public function getColumns(): array
149152

150153
public function getExportFileName(): string
151154
{
152-
return str_replace(' ', '-', $this->label());
155+
return str_replace(' ', '-', $this->getLabel());
153156
}
154157

155158
public function render(): View

src/Importer/Importer.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,15 @@ abstract public function getImportUrl(): string;
2626

2727
abstract public function handle(array $data): int;
2828

29-
abstract public function label(): string;
30-
3129
public function getLabel(): string
3230
{
33-
return apply_filters('data_synchronize_importer_label', $this->label());
31+
return str(static::class)
32+
->afterLast('\\')
33+
->snake()
34+
->replace('_', ' ')
35+
->remove('importer')
36+
->trim()
37+
->title();
3438
}
3539

3640
public static function make(): static

0 commit comments

Comments
 (0)