Skip to content

Commit 93ecaeb

Browse files
Fix styling
1 parent dc628aa commit 93ecaeb

File tree

13 files changed

+111
-115
lines changed

13 files changed

+111
-115
lines changed

database/migrations/2024_03_07_111406_update_user_table.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,4 @@ public function down(): void
6060
{
6161
// Sorry, it's the user table
6262
}
63-
};
63+
};

database/migrations/2025_03_07_130546_create_tag_translations.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@ public function up(): void
2121

2222
// Ensure slug is unique per locale
2323
$table->unique(['slug', 'locale'], 'unique_slug_per_locale');
24-
24+
2525
// Ensure one translation per locale per tag
2626
$table->unique(['tag_id', 'locale'], 'unique_translation_per_locale');
27-
27+
2828
// Foreign key constraint
2929
$table->foreign('tag_id')
3030
->references('id')
3131
->on('tags')
3232
->onDelete('cascade');
33-
33+
3434
// Add index for faster slug lookups
3535
$table->index(['slug'], 'tag_translations_slug_index');
3636
});

database/migrations/2025_03_12_093353_change_media_table.php.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*/
1212
public function up(): void
1313
{
14-
if (!Schema::hasColumn('media', 'name')) {
14+
if (! Schema::hasColumn('media', 'name')) {
1515
Schema::table('media', function (Blueprint $table) {
1616
$table->string('name')->nullable();
1717
$table->string('title')->nullable();

packages/localization/src/Filament/Tables/Columns/TranslationColumn.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ protected function setUp(): void
1717
->toggleable()
1818
->searchable();
1919
}
20-
}
20+
}

packages/localization/src/View/Components/TranslationTabs.php

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,14 @@
44

55
namespace Moox\Localization\View\Components;
66

7-
use Filament\Forms\Components\Tabs;
7+
use Filament\Forms\Components\Component;
8+
use Filament\Forms\Components\Component as FilamentComponent;
9+
use Filament\Forms\Components\MarkdownEditor;
810
use Filament\Forms\Components\Tabs\Tab;
911
use Filament\Forms\Components\TextInput;
10-
use Filament\Forms\Components\MarkdownEditor;
1112
use Filament\Forms\Set;
12-
use Filament\Forms\Components\Component as FilamentComponent;
1313
use Illuminate\Support\Str;
1414
use Illuminate\Validation\Rules\Unique;
15-
use Filament\Forms\Components\Component;
1615

1716
class TranslationTabs extends Component
1817
{
@@ -24,15 +23,13 @@ public function __construct(
2423
public ?string $model = null,
2524
public ?string $table = null,
2625
public ?string $column = null,
27-
) {
28-
}
26+
) {}
2927

3028
public function getTabs(): array
3129
{
32-
return collect($this->getActiveLocales())->map(fn (string $locale) =>
33-
Tab::make($locale)
34-
->label(strtoupper($locale))
35-
->schema($this->getTabSchema($locale))
30+
return collect($this->getActiveLocales())->map(fn (string $locale) => Tab::make($locale)
31+
->label(strtoupper($locale))
32+
->schema($this->getTabSchema($locale))
3633
)->toArray();
3734
}
3835

@@ -63,7 +60,7 @@ protected function createComponent(array $field, string $locale): ?FilamentCompo
6360
{
6461
$fieldName = $field['name'];
6562
$fieldType = $field['type'] ?? 'text';
66-
$fieldLabel = $field['label'] ?? __('core::core.' . $fieldName);
63+
$fieldLabel = $field['label'] ?? __('core::core.'.$fieldName);
6764
$fieldRequired = $field['required'] ?? true;
6865
$fieldUnique = $field['unique'] ?? false;
6966
$fieldComponent = $field['component'] ?? null;
@@ -100,7 +97,7 @@ protected function createComponent(array $field, string $locale): ?FilamentCompo
10097
$translation = $component->getRecord()?->translations
10198
->where('locale', $locale)
10299
->first();
103-
100+
104101
if ($translation) {
105102
$component->state($translation->{$fieldName});
106103
}
@@ -139,4 +136,4 @@ protected function createComponent(array $field, string $locale): ?FilamentCompo
139136

140137
return $component;
141138
}
142-
}
139+
}

packages/media/src/MediaServiceProvider.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@
77
use Filament\Support\Assets\Css;
88
use Filament\Support\Assets\Js;
99
use Filament\Support\Facades\FilamentAsset;
10+
use Filament\Support\Facades\FilamentView;
11+
use Filament\Tables\View\TablesRenderHook;
1012
use Illuminate\Support\Facades\Gate;
1113
use Livewire\Livewire;
1214
use Moox\Media\Http\Livewire\MediaPickerModal;
1315
use Moox\Media\Http\Livewire\MediaUploader;
1416
use Moox\Media\Models\Media;
1517
use Moox\Media\Policies\MediaPolicy;
18+
use Moox\Media\Resources\MediaResource\Pages\ListMedia;
1619
use Spatie\LaravelPackageTools\Package;
17-
use Filament\Support\Facades\FilamentView;
18-
use Filament\Tables\View\TablesRenderHook;
1920
use Spatie\LaravelPackageTools\PackageServiceProvider;
20-
use Moox\Media\Resources\MediaResource\Pages\ListMedia;
2121

2222
class MediaServiceProvider extends PackageServiceProvider
2323
{
@@ -56,6 +56,5 @@ public function boot()
5656
fn (): string => Blade::render('@include("localization::lang-selector")'),
5757
scopes: ListMedia::class
5858
);
59-
6059
}
6160
}

packages/media/src/Models/Media.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
namespace Moox\Media\Models;
44

5+
use Astrotomic\Translatable\Contracts\Translatable as TranslatableContract;
6+
use Astrotomic\Translatable\Translatable;
57
use Illuminate\Database\Eloquent\Relations\MorphTo;
68
use Illuminate\Support\Facades\DB;
79
use Spatie\Image\Enums\Fit;
810
use Spatie\MediaLibrary\HasMedia;
911
use Spatie\MediaLibrary\InteractsWithMedia;
10-
use Astrotomic\Translatable\Translatable;
11-
use Astrotomic\Translatable\Contracts\Translatable as TranslatableContract;
1212
use Spatie\MediaLibrary\MediaCollections\Models\Media as BaseMedia;
1313

1414
class Media extends BaseMedia implements HasMedia, TranslatableContract

packages/tag/database/factories/TagFactory.php

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22

33
namespace Moox\Tag\Database\Factories;
44

5+
use Faker\Factory as FakerFactory;
56
use Illuminate\Database\Eloquent\Factories\Factory;
6-
use Illuminate\Support\Str;
77
use Moox\Tag\Models\Tag;
88
use Moox\Tag\Models\TagTranslation;
9-
use Faker\Factory as FakerFactory;
109

1110
class TagFactory extends Factory
1211
{
@@ -70,7 +69,7 @@ public function configure(): static
7069
// Always create English translation by default
7170
$title = $this->generateLocalizedTitle('en');
7271
$slug = TagTranslation::generateUniqueSlug($title, 'en');
73-
72+
7473
$tag->translateOrNew('en')->fill([
7574
'title' => $title,
7675
'slug' => $slug,
@@ -86,7 +85,7 @@ protected function generateLocalizedTitle(string $locale): string
8685
{
8786
$faker = FakerFactory::create($this->availableLocales[$locale]['faker_locale']);
8887
$sampleWords = $this->availableLocales[$locale]['sample_words'];
89-
88+
9089
// Mix faker words with sample words for more realistic content
9190
if ($this->faker->boolean(30)) {
9291
return $this->faker->randomElement($sampleWords);
@@ -116,14 +115,14 @@ protected function generateLocalizedContent(string $locale): string
116115
*/
117116
public function withTranslation(string $locale): self
118117
{
119-
if (!isset($this->availableLocales[$locale])) {
118+
if (! isset($this->availableLocales[$locale])) {
120119
throw new \InvalidArgumentException("Locale {$locale} is not supported");
121120
}
122121

123122
return $this->afterCreating(function (Tag $tag) use ($locale) {
124123
$title = $this->generateLocalizedTitle($locale);
125124
$slug = TagTranslation::generateUniqueSlug($title, $locale);
126-
125+
127126
$tag->translateOrNew($locale)->fill([
128127
'title' => $title,
129128
'slug' => $slug,
@@ -179,11 +178,13 @@ public function withAllTranslations(): self
179178
{
180179
return $this->afterCreating(function (Tag $tag) {
181180
foreach ($this->availableLocales as $locale => $config) {
182-
if ($locale === 'en') continue; // Skip English as it's already created
183-
181+
if ($locale === 'en') {
182+
continue;
183+
} // Skip English as it's already created
184+
184185
$title = $this->generateLocalizedTitle($locale);
185186
$slug = TagTranslation::generateUniqueSlug($title, $locale);
186-
187+
187188
$tag->translateOrNew($locale)->fill([
188189
'title' => $title,
189190
'slug' => $slug,
@@ -202,8 +203,8 @@ public function withRandomTranslations(int $count = 2): self
202203
$locales = array_keys($this->availableLocales);
203204
unset($locales[array_search('en', $locales)]); // Remove English
204205
$selectedLocales = array_rand(array_flip($locales), min($count, count($locales)));
205-
206-
foreach ((array)$selectedLocales as $locale) {
206+
207+
foreach ((array) $selectedLocales as $locale) {
207208
$this->withTranslation($locale)->configure()->afterCreating->first()($tag);
208209
}
209210
});

packages/tag/database/seeders/DatabaseSeeder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ public function run(): void
1212
TagSeeder::class,
1313
]);
1414
}
15-
}
15+
}

packages/tag/database/seeders/TagSeeder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,4 @@ public function run(): void
4343
->withDutchTranslation()
4444
->create();
4545
}
46-
}
46+
}

0 commit comments

Comments
 (0)