diff --git a/app/Actions/ViewDataAction.php b/app/Actions/ViewDataAction.php index f00153d..c062c1a 100644 --- a/app/Actions/ViewDataAction.php +++ b/app/Actions/ViewDataAction.php @@ -4,6 +4,7 @@ use App\DTO\ContactDTO; use App\Enums\ContactSectionEnum; +use App\Models\Configuration; use App\Models\Contact; use App\Models\News; use App\Models\Product; @@ -14,6 +15,15 @@ class ViewDataAction { + public function configuration(string $locale): ?Configuration + { + $key = Str::slug("configuration_{$locale}"); + + return Cache::rememberForever($key, function () { + return Configuration::first(); + }); + } + public function products(string $locale): Collection { $key = Str::slug("products_published_{$locale}"); diff --git a/app/Models/Configuration.php b/app/Models/Configuration.php new file mode 100644 index 0000000..0a7dacc --- /dev/null +++ b/app/Models/Configuration.php @@ -0,0 +1,19 @@ + 'json', + ]; +} diff --git a/app/View/Components/AppLayout.php b/app/View/Components/AppLayout.php index c569b48..590a611 100644 --- a/app/View/Components/AppLayout.php +++ b/app/View/Components/AppLayout.php @@ -17,6 +17,7 @@ public function render(): View $locale = app()->getLocale(); return view('layouts.app')->with([ + 'configuration' => (new ViewDataAction)->configuration($locale), 'locales' => LocaleEnum::cases(), 'locale' => Str::slug($locale), 'page' => $this->page, diff --git a/composer.json b/composer.json index 741cb68..4f5997c 100644 --- a/composer.json +++ b/composer.json @@ -23,6 +23,7 @@ "spatie/laravel-permission": "^6.7", "spatie/laravel-responsecache": "^7.6", "spatie/laravel-sitemap": "^7.3", + "spatie/laravel-translatable": "^6.11", "spatie/security-advisories-health-check": "^1.2" }, "require-dev": { diff --git a/composer.lock b/composer.lock index a0690a1..0dbfa87 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "1dd5f80b4b7f073ed3fceed6e2d193fa", + "content-hash": "6b5212ce6fcb14098a89c01797590ab2", "packages": [ { "name": "aws/aws-crt-php", @@ -5287,6 +5287,89 @@ ], "time": "2025-04-10T12:13:41+00:00" }, + { + "name": "spatie/laravel-translatable", + "version": "6.11.4", + "source": { + "type": "git", + "url": "https://github.com/spatie/laravel-translatable.git", + "reference": "032d85b28de315310dab2048b857016f1194f68b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/spatie/laravel-translatable/zipball/032d85b28de315310dab2048b857016f1194f68b", + "reference": "032d85b28de315310dab2048b857016f1194f68b", + "shasum": "" + }, + "require": { + "illuminate/database": "^10.0|^11.0|^12.0", + "illuminate/support": "^10.0|^11.0|^12.0", + "php": "^8.0", + "spatie/laravel-package-tools": "^1.11" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^3.64", + "mockery/mockery": "^1.4", + "orchestra/testbench": "^7.0|^8.0|^9.0|^10.0", + "pestphp/pest": "^1.20|^2.0|^3.0" + }, + "type": "library", + "extra": { + "aliases": { + "Translatable": "Spatie\\Translatable\\Facades\\Translatable" + }, + "laravel": { + "providers": [ + "Spatie\\Translatable\\TranslatableServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Spatie\\Translatable\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Freek Van der Herten", + "email": "freek@spatie.be", + "homepage": "https://spatie.be", + "role": "Developer" + }, + { + "name": "Sebastian De Deyne", + "email": "sebastian@spatie.be", + "homepage": "https://spatie.be", + "role": "Developer" + } + ], + "description": "A trait to make an Eloquent model hold translations", + "homepage": "https://github.com/spatie/laravel-translatable", + "keywords": [ + "eloquent", + "i8n", + "laravel-translatable", + "model", + "multilingual", + "spatie", + "translate" + ], + "support": { + "issues": "https://github.com/spatie/laravel-translatable/issues", + "source": "https://github.com/spatie/laravel-translatable/tree/6.11.4" + }, + "funding": [ + { + "url": "https://github.com/spatie", + "type": "github" + } + ], + "time": "2025-02-20T15:51:22+00:00" + }, { "name": "spatie/packagist-api", "version": "2.1.1", diff --git a/database/factories/ConfigurationFactory.php b/database/factories/ConfigurationFactory.php new file mode 100644 index 0000000..2a377be --- /dev/null +++ b/database/factories/ConfigurationFactory.php @@ -0,0 +1,23 @@ + + */ +class ConfigurationFactory extends Factory +{ + /** + * Define the model's default state. + * + * @return array + */ + public function definition(): array + { + return [ + // + ]; + } +} diff --git a/database/migrations/2025_06_23_225051_create_configurations_table.php b/database/migrations/2025_06_23_225051_create_configurations_table.php new file mode 100644 index 0000000..5bd9c03 --- /dev/null +++ b/database/migrations/2025_06_23_225051_create_configurations_table.php @@ -0,0 +1,33 @@ +id(); + $table->string('logo')->nullable(); + $table->json('contact')->nullable(); + $table->json('terms')->nullable(); + $table->json('imprint')->nullable(); + $table->json('privacy')->nullable(); + $table->json('footer')->nullable(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('configurations'); + } +}; diff --git a/database/seeders/Codebar/ConfigurationsTableSeeder.php b/database/seeders/Codebar/ConfigurationsTableSeeder.php new file mode 100644 index 0000000..0886584 --- /dev/null +++ b/database/seeders/Codebar/ConfigurationsTableSeeder.php @@ -0,0 +1,23 @@ + 'layouts._logos._codebar', + 'footer' => [ + LocaleEnum::DE->value => 'codebar Solutions AG', + ], + ]); + } +} diff --git a/database/seeders/CodebarSeeder.php b/database/seeders/CodebarSeeder.php index 419c3bf..c202880 100644 --- a/database/seeders/CodebarSeeder.php +++ b/database/seeders/CodebarSeeder.php @@ -2,6 +2,7 @@ namespace Database\Seeders; +use Database\Seeders\Codebar\ConfigurationsTableSeeder; use Illuminate\Cache\Console\ClearCommand; use Illuminate\Database\Seeder; use Illuminate\Support\Facades\Artisan; @@ -15,6 +16,8 @@ class CodebarSeeder extends Seeder */ public function run(): void { + $this->call(ConfigurationsTableSeeder::class); + if (app()->isLocal()) { Artisan::call(ClearCommand::class); } diff --git a/database/seeders/Paperflakes/ConfigurationsTableSeeder.php b/database/seeders/Paperflakes/ConfigurationsTableSeeder.php new file mode 100644 index 0000000..4ff0188 --- /dev/null +++ b/database/seeders/Paperflakes/ConfigurationsTableSeeder.php @@ -0,0 +1,23 @@ + 'layouts._logos._paperflakes', + 'footer' => [ + LocaleEnum::DE->value => 'paperflakes AG', + ], + ]); + } +} diff --git a/database/seeders/PaperflakesSeeder.php b/database/seeders/PaperflakesSeeder.php index ce5f1f8..d4b66c9 100644 --- a/database/seeders/PaperflakesSeeder.php +++ b/database/seeders/PaperflakesSeeder.php @@ -2,6 +2,7 @@ namespace Database\Seeders; +use Database\Seeders\Paperflakes\ConfigurationsTableSeeder; use Database\Seeders\Paperflakes\ContactsTableSeeder; use Database\Seeders\Paperflakes\NewsTableSeeder; use Database\Seeders\Paperflakes\PagesTableSeeder; @@ -18,6 +19,7 @@ class PaperflakesSeeder extends Seeder */ public function run(): void { + $this->call(ConfigurationsTableSeeder::class); $this->call(PagesTableSeeder::class); $this->call(NewsTableSeeder::class); $this->call(ProductsTableSeeder::class); diff --git a/lang/de_CH.json b/lang/de_CH.json index d00caf2..17c9a9b 100644 --- a/lang/de_CH.json +++ b/lang/de_CH.json @@ -17,6 +17,7 @@ "EN": "EN", "English": "English", "Google Maps": "Google Maps", + "Headquarter": "Hauptsitz", "Imprint": "Impressum", "Info(at)paperflakes.ch": "Info(at)paperflakes.ch", "Jobs": "Jobs", diff --git a/lang/en_CH.json b/lang/en_CH.json index 1c9a0c2..39ca383 100644 --- a/lang/en_CH.json +++ b/lang/en_CH.json @@ -17,6 +17,7 @@ "EN": "EN", "English": "English", "Google Maps": "Google Maps", + "Headquarter": "Headquarter", "Imprint": "Imprint", "Info(at)paperflakes.ch": "Info(at)paperflakes.ch", "Jobs": "Jobs", diff --git a/resources/views/app/about-us/index.blade.php b/resources/views/app/about-us/index.blade.php index 644590e..0fa36e0 100644 --- a/resources/views/app/about-us/index.blade.php +++ b/resources/views/app/about-us/index.blade.php @@ -15,8 +15,11 @@ @foreach($contacts->employee_services as $contact) - + @endforeach @endif diff --git a/resources/views/app/contact/index.blade.php b/resources/views/app/contact/index.blade.php index e86a11f..3a56068 100644 --- a/resources/views/app/contact/index.blade.php +++ b/resources/views/app/contact/index.blade.php @@ -15,15 +15,17 @@ classAttributes="block"/> -

paperflakes AG

+

{{ __('Headquarter') }}

Haupstrasse 91

CH-4455 Zunzgen

- +

paperflakes AG

-

{{__('Branch office')}}

+

{{__('Branch office')}}

Langegasse 39

CH-4104 Oberwil

- - + +
- \ No newline at end of file diff --git a/resources/views/app/legal/imprint/index.blade.php b/resources/views/app/legal/imprint/index.blade.php index 0aaa48e..16513f0 100644 --- a/resources/views/app/legal/imprint/index.blade.php +++ b/resources/views/app/legal/imprint/index.blade.php @@ -1,9 +1,7 @@ - -

paperflakes AG

Mühlematten 12

@@ -11,12 +9,8 @@

CHE-432.585.498

- - - + +
diff --git a/resources/views/components/list-image-card.blade.php b/resources/views/components/list-image-card.blade.php index 902d295..af05169 100644 --- a/resources/views/components/list-image-card.blade.php +++ b/resources/views/components/list-image-card.blade.php @@ -7,7 +7,7 @@ ])
-
+
{{ $name }}
diff --git a/resources/views/components/logo-paperflakes.blade.php b/resources/views/layouts/_logos/_codebar.blade.php similarity index 100% rename from resources/views/components/logo-paperflakes.blade.php rename to resources/views/layouts/_logos/_codebar.blade.php diff --git a/resources/views/layouts/_logos/_paperflakes.blade.php b/resources/views/layouts/_logos/_paperflakes.blade.php new file mode 100644 index 0000000..da264c1 --- /dev/null +++ b/resources/views/layouts/_logos/_paperflakes.blade.php @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/resources/views/layouts/_partials/_footer.blade.php b/resources/views/layouts/_partials/_footer.blade.php index ee89c67..a2be1a6 100644 --- a/resources/views/layouts/_partials/_footer.blade.php +++ b/resources/views/layouts/_partials/_footer.blade.php @@ -71,8 +71,10 @@ classAttributes="text-lg"/> @include('layouts._partials._footer.labels')
-
- © {{ date('Y') }} {{ __('paperflakes AG') }} -
+ @if(filled($configuration?->footer)) +
+ © {{ date('Y') }} {{ $configuration->footer }} +
+ @endif
diff --git a/resources/views/layouts/_partials/_navigation.blade.php b/resources/views/layouts/_partials/_navigation.blade.php index dfbd5e9..5817c6c 100644 --- a/resources/views/layouts/_partials/_navigation.blade.php +++ b/resources/views/layouts/_partials/_navigation.blade.php @@ -1,9 +1,11 @@