Skip to content

Commit 96bb889

Browse files
Feature/translations (#764)
* wip * Fix styling * Added publish action and url lang support * Changed Folder directories * Changed all Namespaces of TaxonomyCreateForm * phpstan fixes * Fix styling * wip commented test * Update ExampleTest.php * created migrations for translation * added bases to Category * added restoreaction to base * created translation base model * changed dependecies localization and astrotomic * cleanup logs from draft model * added Lang Select * Update CategoryResource * cleanup Middleware * added translatable compatibility * cleaning * feat category translation de * update category Model etc for field data * Update Localization with translation de * update composer * Update DataPanelProvider.php * add basedata * add filament/spatie-laravel-media-library-plugin dependency * auto discover migrations
1 parent f9b3fb8 commit 96bb889

65 files changed

Lines changed: 816 additions & 778 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

app/Providers/Filament/AdminPanelProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
use Illuminate\Session\Middleware\StartSession;
2020
use Illuminate\View\Middleware\ShareErrorsFromSession;
2121
use Moox\Audit\AuditPlugin;
22-
use Moox\Category\CategoryPlugin;
22+
use Moox\Category\Moox\Entities\Categories\Plugins\CategoryPlugin;
2323
use Moox\Data\Filament\Plugins\StaticCountryPlugin;
2424
use Moox\Data\Filament\Plugins\StaticCurrencyPlugin;
2525
use Moox\Data\Filament\Plugins\StaticLanguagePlugin;

config/previews/full-pro-item.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

3-
use Moox\Category\Forms\TaxonomyCreateForm;
43
use Moox\Category\Models\Category;
4+
use Moox\Category\Moox\Entities\Categories\Category\Forms\TaxonomyCreateForm;
55
use Moox\Tag\Models\Tag;
66

77
return [

config/previews/preview-simple-item.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
'relationship' => 'categorizable',
6565
'foreignKey' => 'categorizable_id',
6666
'relatedKey' => 'category_id',
67-
'createForm' => \Moox\Category\Forms\TaxonomyCreateForm::class,
67+
'createForm' => \Moox\Category\Moox\Entities\Categories\Category\Forms\TaxonomyCreateForm::class,
6868
'hierarchical' => true,
6969
],
7070

config/previews/simple-item.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
'relationship' => 'categorizable',
4343
'foreignKey' => 'categorizable_id',
4444
'relatedKey' => 'category_id',
45-
'createForm' => \Moox\Category\Forms\TaxonomyCreateForm::class,
45+
'createForm' => \Moox\Category\Moox\Entities\Categories\Category\Forms\TaxonomyCreateForm::class,
4646
'hierarchical' => true,
4747
],
4848
'tag' => [

config/previews/soft-delete-item.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
'relationship' => 'categorizable',
3737
'foreignKey' => 'categorizable_id',
3838
'relatedKey' => 'category_id',
39-
'createForm' => \Moox\Category\Forms\TaxonomyCreateForm::class,
39+
'createForm' => \Moox\Category\Moox\Entities\Categories\Category\Forms\TaxonomyCreateForm::class,
4040
'hierarchical' => true,
4141
],
4242

database/migrations/2024_10_22_080008_create_categories_table.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@ public function up(): void
1414
{
1515
Schema::create('categories', function (Blueprint $table) {
1616
$table->id();
17-
$table->string('title');
18-
$table->string('slug')->unique();
1917
$table->string('featured_image_url')->nullable();
20-
$table->text('content')->nullable();
2118
$table->integer('weight')->nullable();
2219
$table->integer('count')->nullable();
2320
$table->string('color')->nullable();
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*/
12+
public function up(): void
13+
{
14+
Schema::create('category_translations', function (Blueprint $table) {
15+
$table->increments('id');
16+
$table->unsignedBigInteger('category_id');
17+
$table->string('locale')->index();
18+
$table->string('title');
19+
$table->string('status')->default('draft');
20+
$table->string('slug');
21+
$table->text('content')->nullable();
22+
23+
24+
// Schedule fields
25+
$table->timestamp(column: 'to_publish_at')->nullable();
26+
$table->timestamp('published_at')->nullable();
27+
$table->timestamp('to_unpublish_at')->nullable();
28+
$table->timestamp('unpublished_at')->nullable();
29+
30+
// Actor fields
31+
$table->nullableMorphs('published_by', 'cat_trans_pub_idx');
32+
$table->nullableMorphs('unpublished_by', 'cat_trans_unpub_idx');
33+
34+
$table->foreignId('author_id')->nullable()->constrained('users')->nullOnDelete();
35+
36+
// Soft delete fields
37+
$table->softDeletes();
38+
$table->nullableMorphs('deleted_by');
39+
$table->timestamp('restored_at')->nullable();
40+
$table->nullableMorphs('restored_by');
41+
42+
// Timestamps
43+
$table->timestamps();
44+
45+
$table->unique(['category_id', 'locale']);
46+
$table->foreign('category_id')->references('id')->on('categories')->onDelete('cascade');
47+
});
48+
}
49+
50+
/**
51+
* Reverse the migrations.
52+
*/
53+
public function down(): void
54+
{
55+
Schema::dropIfExists('category_translations');
56+
}
57+
};

packages/category/composer.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@
1919
"require": {
2020
"moox/core": "*",
2121
"codewithdennis/filament-select-tree": "^3.1",
22-
"kalnoy/nestedset": "^6.0"
22+
"moox/localization": "*",
23+
"kalnoy/nestedset": "^6.0",
24+
"moox/flag-icons-circle": "*",
25+
"moox/slug": "*"
2326
},
2427
"autoload": {
2528
"psr-4": {

packages/category/config/category.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838
|
3939
*/
4040

41-
'single' => 'trans//category::translations.category',
42-
'plural' => 'trans//category::translations.categories',
41+
'single' => 'trans//category::category.category',
42+
'plural' => 'trans//category::category.categories',
4343

4444
/*
4545
|--------------------------------------------------------------------------

packages/category/database/migrations/create_categories_table.php.stub

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@ return new class extends Migration
1414
{
1515
Schema::create('categories', function (Blueprint $table) {
1616
$table->id();
17-
$table->string('title');
18-
$table->string('slug')->unique();
1917
$table->string('featured_image_url')->nullable();
20-
$table->text('content')->nullable();
2118
$table->integer('weight')->nullable();
2219
$table->integer('count')->nullable();
2320
$table->string('color')->nullable();
@@ -31,7 +28,6 @@ return new class extends Migration
3128
* Reverse the migrations.
3229
*/
3330
public function down(): void
34-
3531
{
3632
Schema::dropIfExists('categories');
3733
}

0 commit comments

Comments
 (0)