Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions app/Actions/ViewDataAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,7 @@ public function contacts(string $locale): object
->get();

return (object) collect([
ContactSectionEnum::EMPLOYEE_SERVICES,
ContactSectionEnum::EMPLOYEE_PRODUCTS,
ContactSectionEnum::EMPLOYEE_ADMINISTRATION,
ContactSectionEnum::EMPLOYEES,
ContactSectionEnum::COLLABORATIONS,
ContactSectionEnum::BOARD_MEMBERS,
])->mapWithKeys(function (string $section) use ($publishedContacts, $locale): array {
Expand Down
6 changes: 1 addition & 5 deletions app/Enums/ContactSectionEnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@

enum ContactSectionEnum: string
{
const string EMPLOYEE_SERVICES = 'employee_services';

const string EMPLOYEE_PRODUCTS = 'employee_products';

const string EMPLOYEE_ADMINISTRATION = 'employee_administration';
const string EMPLOYEES = 'employees';

const string COLLABORATIONS = 'collaborations';

Expand Down
24 changes: 24 additions & 0 deletions app/Http/Controllers/News/NewsIndexController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

namespace App\Http\Controllers\News;

use App\Actions\PageAction;
use App\Actions\ViewDataAction;
use App\Http\Controllers\Controller;
use Illuminate\View\View;

class NewsIndexController extends Controller
{
/**
* Display the user's profile form.
*/
public function __invoke(): View
{
$locale = app()->getLocale();

return view('app.news.index')->with([
'page' => (new PageAction(locale: null, routeName: 'news.index'))->default(),
'news' => (new ViewDataAction)->news($locale),
]);
}
}
38 changes: 25 additions & 13 deletions app/Http/Controllers/Sitemap/SitemapController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use App\Models\Service;
use App\Sitemap\SitemapBuilder;
use Illuminate\Http\Response;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Cache;

class SitemapController extends Controller
Expand Down Expand Up @@ -44,35 +45,46 @@ public function __invoke(): Response
});

return response(content: $content)
->header('Content-Type', 'application/xml');
->header('Content-Type', 'application/xml')
->header('Cache-Control', 'public, max-age=3600'); // Cache for 1 hour
}

private function builder(): void
{
$this->addDefaultRoutesToSitemap();

// Use chunked queries to prevent memory issues
News::whereNotNull('published_at')
->with('references')
->each(function (News $news): void {
$this->addLocalizedPageSet(
page: (new PageAction(locale: null, routeName: null))->news(news: $news, withReferences: true),
);
->chunk(100, function (Collection $news): void {
/** @var News $item */
foreach ($news as $item) {
$this->addLocalizedPageSet(
page: (new PageAction(locale: null, routeName: null))->news(news: $item, withReferences: true),
);
}
});

Service::where('published', true)
->with('references')
->each(function (Service $service): void {
$this->addLocalizedPageSet(
page: (new PageAction(locale: null, routeName: null))->service(service: $service, withReferences: true),
);
->chunk(100, function (Collection $services): void {
/** @var Service $item */
foreach ($services as $item) {
$this->addLocalizedPageSet(
page: (new PageAction(locale: null, routeName: null))->service(service: $item, withReferences: true),
);
}
});

Product::where('published', true)
->with('references')
->each(function (Product $product): void {
$this->addLocalizedPageSet(
page: (new PageAction(locale: null, routeName: null))->product(product: $product, withReferences: true),
);
->chunk(100, function (Collection $products): void {
/** @var Product $item */
foreach ($products as $item) {
$this->addLocalizedPageSet(
page: (new PageAction(locale: null, routeName: null))->product(product: $item, withReferences: true),
);
}
});
}

Expand Down
2 changes: 2 additions & 0 deletions app/Models/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ class Configuration extends Model
use HasFactory;

protected $casts = [
'component_intro' => 'json',
'section_news' => 'boolean',
'section_services' => 'boolean',
'section_products' => 'boolean',
'section_technologies' => 'boolean',
Expand Down
73 changes: 14 additions & 59 deletions config/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,48 +42,13 @@
'mysql' => [
'driver' => 'mysql',
'url' => env('DB_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => env('DB_CHARSET', 'utf8mb4'),
'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],

'logs' => [
'driver' => 'mysql',
'url' => env('LOGS_DATABASE_URL'),
'host' => env('LOGS_DB_HOST', '127.0.0.1'),
'port' => env('LOGS_DB_PORT', '3306'),
'database' => env('LOGS_DB_DATABASE', 'forge'),
'username' => env('LOGS_DB_USERNAME', 'forge'),
'password' => env('LOGS_DB_PASSWORD', ''),
'unix_socket' => env('LOGS_DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('LOGS_MYSQL_ATTR_SSL_CA'),
]) : [],
'ssl_mode' => env('LOGS_SSL_MODE', 'required'),
],

'mariadb' => [
'driver' => 'mariadb',
'url' => env('DB_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'read' => [
'host' => env('DB_READ_HOST', env('DB_HOST')),
],
'write' => [
'host' => env('DB_WRITE_HOST', env('DB_HOST')),
],
// 'host' => env('DB_HOST'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
Expand All @@ -103,7 +68,13 @@
'pgsql' => [
'driver' => 'pgsql',
'url' => env('DB_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'read' => [
'host' => env('DB_READ_HOST', env('DB_HOST')),
],
'write' => [
'host' => env('DB_WRITE_HOST', env('DB_HOST')),
],
// 'host' => env('DB_HOST'),
'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
Expand All @@ -114,22 +85,6 @@
'search_path' => 'public',
'sslmode' => 'prefer',
],

'sqlsrv' => [
'driver' => 'sqlsrv',
'url' => env('DB_URL'),
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '1433'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => env('DB_CHARSET', 'utf8'),
'prefix' => '',
'prefix_indexes' => true,
// 'encrypt' => env('DB_ENCRYPT', 'yes'),
// 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'),
],

],

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ public function up(): void
$table->id();

$table->string('company')->nullable();
$table->string('company_primary_color')->nullable();

$table->json('component_intro');

$table->boolean('section_news')->default(false);
$table->boolean('section_services')->default(false);
$table->boolean('section_products')->default(false);
$table->boolean('section_technologies')->default(false);
Expand Down
8 changes: 8 additions & 0 deletions database/seeders/Codebar/ConfigurationsTableSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Database\Seeders\Codebar;

use App\Enums\LocaleEnum;
use App\Models\Configuration;
use Illuminate\Database\Seeder;

Expand All @@ -15,7 +16,14 @@ public function run(): void
Configuration::updateOrCreate([], [

'company' => 'codebar Solutions AG',
'company_primary_color' => '#500472',

'component_intro' => [
LocaleEnum::DE->value => file_get_contents(database_path('seeders/files/codebar_intro_de.md')),
LocaleEnum::EN->value => file_get_contents(database_path('seeders/files/codebar_intro_en.md')),
],

'section_news' => false,
'section_services' => false,
'section_products' => false,
'section_technologies' => true,
Expand Down
84 changes: 66 additions & 18 deletions database/seeders/Codebar/ContactsTableSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ public function run(): void
'name' => 'Sebastian Bürgin-Fix',
'published' => true,
'sections' => [
ContactSectionEnum::EMPLOYEE_SERVICES => [
'key' => ContactSectionEnum::EMPLOYEE_SERVICES,
ContactSectionEnum::EMPLOYEES => [
'key' => ContactSectionEnum::EMPLOYEES,
'role' => [
'de_CH' => 'Software-Architekt',
'en_CH' => 'Software-Engineer',
Expand All @@ -38,45 +38,93 @@ public function run(): void
Contact::updateOrCreate(
['id' => 2],
[
'name' => 'Rhys Lees',
'published' => false,
'name' => 'Melanie Bürgin-Fix',
'published' => true,
'sections' => [
ContactSectionEnum::EMPLOYEE_SERVICES => [
'key' => ContactSectionEnum::EMPLOYEE_SERVICES,
ContactSectionEnum::EMPLOYEES => [
'key' => ContactSectionEnum::EMPLOYEES,
'role' => [
'de_CH' => 'Entwickler',
'en_CH' => 'Developer',
'de_CH' => 'Administration',
'en_CH' => 'Administration',
],
],
ContactSectionEnum::BOARD_MEMBERS => [
'key' => ContactSectionEnum::BOARD_MEMBERS,
],
],
'icons' => [
'email' => 'rhys.leess@codebar.ch',
'linkedin' => 'https://www.linkedin.com/in/rhys-lees',
'email' => 'melanie.buergin@codebar.ch',
'linkedin' => 'https://www.linkedin.com/in/melanie-buergin',
],
'image' => 'https://res.cloudinary.com/codebar/image/upload/w_400,h_400,f_auto,q_auto/www-paperflakes-ch/people/r_lees_e_background_removal_f_png.webp',
'image' => 'https://res.cloudinary.com/codebar/image/upload/w_400,h_400,f_auto,q_auto/www-paperflakes-ch/people/codebar.webp',
]
);

Contact::updateOrCreate(
['id' => 7],
['id' => 3],
[
'name' => 'Sebastian Bürgin-Fix',
'name' => 'Tobias Brogle',
'published' => true,
'sections' => [
ContactSectionEnum::EMPLOYEES => [
'key' => ContactSectionEnum::EMPLOYEES,
'role' => [
'de_CH' => 'Applikationsentwickler',
'en_CH' => 'Application Developer',
],
],
],
'icons' => [
'email' => 'tobias.brogle@codebar.ch',
'linkedin' => null,
],
'image' => 'https://res.cloudinary.com/codebar/image/upload/w_400,h_400,f_auto,q_auto/www-paperflakes-ch/people/codebar.webp',
]
);

Contact::updateOrCreate(
['id' => 4],
[
'name' => 'Alexander Christoph Boll',
'published' => false,
'sections' => [
ContactSectionEnum::EMPLOYEES => [
'key' => ContactSectionEnum::EMPLOYEES,
'role' => [
'de_CH' => 'Produktentwickler',
'en_CH' => 'Product Developer',
],
],
],
'icons' => [
'email' => 'alexander.boll@codebar.ch',
'linkedin' => 'https://www.linkedin.com/in/alexanderboll',
],
'image' => 'https://res.cloudinary.com/codebar/image/upload/w_400,h_400,f_auto,q_auto/www-paperflakes-ch/people/codebar.webp',
]
);

Contact::updateOrCreate(
['id' => 6],
[
'name' => 'PST GmbH',
'published' => false,
'sections' => [
ContactSectionEnum::COLLABORATIONS => [
'key' => ContactSectionEnum::COLLABORATIONS,
'role' => [
'de_CH' => 'paperflakes AG',
'en_CH' => 'paperflakes AG',
'de_CH' => 'Finanzen',
'en_CH' => 'Finance',
],
],
],
'icons' => [
'email' => 'info@paperflakes.ch',
'website' => 'https://www.paperflakes.ch',
'email' => 'info@pstgmbh.ch',
'website' => 'https://www.pstgmbh.ch',
],
'image' => 'https://res.cloudinary.com/codebar/image/upload/w_400,h_400,f_auto,q_auto/www-paperflakes-ch/people/paperflakes.webp',
'image' => 'https://res.cloudinary.com/codebar/image/upload/w_400,h_400,f_auto,q_auto/www-paperflakes-ch/people/codebar.webp',
]
);

}
}
8 changes: 8 additions & 0 deletions database/seeders/Paperflakes/ConfigurationsTableSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Database\Seeders\Paperflakes;

use App\Enums\LocaleEnum;
use App\Models\Configuration;
use Illuminate\Database\Seeder;

Expand All @@ -14,7 +15,14 @@ public function run(): void
{
Configuration::updateOrCreate([], [
'company' => 'paperflakes AG',
'company_primary_color' => '#69b3a1',

'component_intro' => [
LocaleEnum::DE->value => file_get_contents(database_path('seeders/files/paperflakes_intro_de.md')),
LocaleEnum::EN->value => file_get_contents(database_path('seeders/files/paperflakes_intro_en.md')),
],

'section_news' => true,
'section_services' => true,
'section_products' => true,
'section_technologies' => false,
Expand Down
Loading