From 3ea4ba52e36ed3892cc0cc30be4428670f518ad1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 Aug 2026 02:54:27 +0000 Subject: [PATCH 1/2] chore(deps): update laravel/head requirement from ^0.1 to ^0.1 || ^0.2 Updates the requirements on [laravel/head](https://github.com/laravel/head) to permit the latest version. - [Release notes](https://github.com/laravel/head/releases) - [Changelog](https://github.com/laravel/head/blob/main/CHANGELOG.md) - [Commits](https://github.com/laravel/head/compare/v0.1.0...v0.2.0) --- updated-dependencies: - dependency-name: laravel/head dependency-version: 0.2.0 dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 533cfe0..9883cfc 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ "require": { "php": "^8.2|^8.3|^8.4", "intervention/image": "^4.0.0", - "laravel/head": "^0.1", + "laravel/head": "^0.1 || ^0.2", "laravel/passkeys": "^0.1 || ^0.2", "livewire/livewire": "^4.2.1", "secondnetwork/blade-tabler-icons": "^3.40.1", From 1643693f370a77273259870a5aa0ea13ee435393 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 Aug 2026 02:54:50 +0000 Subject: [PATCH 2/2] style: apply Pint formatting --- app/Providers/KompassServiceProvider.php | 5 +- rector.php | 12 +-- routes/web.php | 3 +- src/Commands/UpdateCommand.php | 3 +- src/DataWriter/FileWriter.php | 2 +- src/KompassFacade.php | 3 +- src/Livewire/BlocksData.php | 29 ++++--- src/Livewire/BlocksTable.php | 76 +++++++++++++------ src/Livewire/CategoryTable.php | 51 ++++++++----- src/Livewire/DatafieldItem.php | 4 +- src/Livewire/EditableMeta.php | 2 +- src/Livewire/EditableName.php | 2 +- src/Livewire/FieldEditor.php | 11 +-- src/Livewire/MediaComponents/MediaItem.php | 4 +- src/Livewire/MenuData.php | 4 +- src/Livewire/MenuProfile.php | 5 +- src/Livewire/MenuTable.php | 56 ++++++++++---- src/Livewire/Settings/ActivityLog.php | 7 +- src/Livewire/Settings/AdminPanel.php | 24 +++--- src/Livewire/Settings/Backendmenu.php | 5 +- src/Livewire/Settings/ErrorLog.php | 2 +- src/Livewire/Settings/Multilingual.php | 9 ++- src/Livewire/Settings/PageAppearance.php | 4 +- src/Livewire/Settings/PageInformation.php | 47 +++++++----- src/Livewire/Setup/Alignment.php | 2 +- src/Livewire/Setup/Color.php | 11 ++- src/Livewire/Setup/Favicon.php | 20 +++-- src/Livewire/Setup/Logo.php | 33 +++++--- src/Models/Menu.php | 12 +-- src/Models/Page.php | 2 +- src/Notifications/ResetPassword.php | 3 +- src/Notifications/VerifyEmail.php | 4 +- src/Traits/LogsActivity.php | 4 +- src/database/factories/UserFactory.php | 2 +- .../2022_10_14_094240_create_meta_table.php | 2 +- ..._08_02_092533_create_permission_tables.php | 6 +- ...11_22_135851_create_activity_log_table.php | 2 +- src/database/seeders/PostSeeder.php | 70 ++++++++--------- .../Auth/VerifyEmailController.php | 3 +- .../views/pages/blog/single/single.php | 2 +- stubs/routes/web.php | 6 +- 41 files changed, 329 insertions(+), 225 deletions(-) diff --git a/app/Providers/KompassServiceProvider.php b/app/Providers/KompassServiceProvider.php index 04a64c2..80b24cc 100644 --- a/app/Providers/KompassServiceProvider.php +++ b/app/Providers/KompassServiceProvider.php @@ -21,8 +21,5 @@ public function register() * * @return void */ - public function boot() - { - - } + public function boot() {} } diff --git a/rector.php b/rector.php index 7dd6107..6060c62 100644 --- a/rector.php +++ b/rector.php @@ -6,12 +6,12 @@ return RectorConfig::configure() ->withPaths([ - __DIR__ . '/app', - __DIR__ . '/config', - __DIR__ . '/public', - __DIR__ . '/resources', - __DIR__ . '/routes', - __DIR__ . '/src', + __DIR__.'/app', + __DIR__.'/config', + __DIR__.'/public', + __DIR__.'/resources', + __DIR__.'/routes', + __DIR__.'/src', ]) // uncomment to reach your current PHP version // ->withPhpSets() diff --git a/routes/web.php b/routes/web.php index 38f493e..4ac9128 100644 --- a/routes/web.php +++ b/routes/web.php @@ -3,9 +3,9 @@ namespace Secondnetwork\Kompass; use Illuminate\Support\Facades\Route; -use Illuminate\Support\Facades\View; use Secondnetwork\Kompass\Http\Controllers\KompassController; use Secondnetwork\Kompass\Livewire\AccountForm; +use Secondnetwork\Kompass\Livewire\Auth\PasskeySetup; use Secondnetwork\Kompass\Livewire\BlocksData; use Secondnetwork\Kompass\Livewire\BlocksTable; use Secondnetwork\Kompass\Livewire\CategoryTable; @@ -21,7 +21,6 @@ use Secondnetwork\Kompass\Livewire\Roles; use Secondnetwork\Kompass\Livewire\Settings; use Secondnetwork\Kompass\Livewire\Settings\Profile; -use Secondnetwork\Kompass\Livewire\Auth\PasskeySetup; // Asset Routes Route::get('assets/{path?}', [KompassController::class, 'assets'])->name('kompass_asset'); diff --git a/src/Commands/UpdateCommand.php b/src/Commands/UpdateCommand.php index 734a294..4bd8287 100644 --- a/src/Commands/UpdateCommand.php +++ b/src/Commands/UpdateCommand.php @@ -4,6 +4,7 @@ use Illuminate\Console\Command; use Illuminate\Support\Facades\File; +use Illuminate\Support\Facades\Process; use function Laravel\Prompts\info; use function Laravel\Prompts\note; @@ -98,7 +99,7 @@ protected function rebuildFrontend(string $packageManager): void if (isset($commands[$packageManager])) { warning('Running: '.$commands[$packageManager]); - $result = \Illuminate\Support\Facades\Process::forever()->run( + $result = Process::forever()->run( $commands[$packageManager], function (string $type, string $output): void { $this->output->write(' '.$output); diff --git a/src/DataWriter/FileWriter.php b/src/DataWriter/FileWriter.php index e59ff7a..d9d057d 100644 --- a/src/DataWriter/FileWriter.php +++ b/src/DataWriter/FileWriter.php @@ -9,7 +9,7 @@ class FileWriter /** * The filesystem instance. * - * @var \Illuminate\Filesystem\Filesystem + * @var Filesystem */ protected $files; diff --git a/src/KompassFacade.php b/src/KompassFacade.php index 1c52b4b..1a2e506 100644 --- a/src/KompassFacade.php +++ b/src/KompassFacade.php @@ -3,9 +3,10 @@ namespace Secondnetwork\Kompass; use Illuminate\Support\Facades\Facade; +use Secondnetwork\Kompass\Skeleton\SkeletonClass; /** - * @see \Secondnetwork\Kompass\Skeleton\SkeletonClass + * @see SkeletonClass */ class KompassFacade extends Facade { diff --git a/src/Livewire/BlocksData.php b/src/Livewire/BlocksData.php index 0366316..9a98f9a 100644 --- a/src/Livewire/BlocksData.php +++ b/src/Livewire/BlocksData.php @@ -114,7 +114,7 @@ private function getIconPath(): string { $possiblePaths = [ base_path('vendor/secondnetwork/blade-tabler-icons/resources/svg'), - dirname(base_path()) . '/vendor/secondnetwork/blade-tabler-icons/resources/svg', + dirname(base_path()).'/vendor/secondnetwork/blade-tabler-icons/resources/svg', public_path('vendor/blade-tabler-icons'), ]; @@ -132,36 +132,35 @@ public function loadIcons() $this->filteredIcons = []; $iconPath = $this->getIconPath(); - - if (empty($iconPath) || !is_dir($iconPath)) { + + if (empty($iconPath) || ! is_dir($iconPath)) { return; } try { $files = File::files($iconPath); - + if (empty($files)) { return; } - + $icons = collect($files) - ->map(fn($file) => str_replace('.svg', '', $file->getFilename())) + ->map(fn ($file) => str_replace('.svg', '', $file->getFilename())) ->sort() ->values(); if ($this->iconSearch) { $search = strtolower(trim($this->iconSearch)); - if (!empty($search)) { - $icons = $icons->filter(fn($name) => - str_contains(strtolower($name), $search) + if (! empty($search)) { + $icons = $icons->filter(fn ($name) => str_contains(strtolower($name), $search) ); } } - $this->filteredIcons = $icons->take(100)->map(fn($name) => [ - 'id' => 'tabler-' . $name, + $this->filteredIcons = $icons->take(100)->map(fn ($name) => [ + 'id' => 'tabler-'.$name, 'name' => $name, - 'full_name' => 'tabler-' . $name, + 'full_name' => 'tabler-'.$name, ])->values()->toArray(); } catch (\Exception $e) { $this->filteredIcons = []; @@ -175,8 +174,8 @@ public function updatedIconSearch() public function selectIcon($name) { - $this->selectedIcon = 'tabler-' . $name; - $this->iconclass = 'tabler-' . $name; + $this->selectedIcon = 'tabler-'.$name; + $this->iconclass = 'tabler-'.$name; } public function resetIcon() @@ -343,7 +342,7 @@ public function updateOrder($list) { foreach ($list as $item) { - blockfields::whereId($item['value'])->update(['order' => $item['order']]); + Blockfields::whereId($item['value'])->update(['order' => $item['order']]); // foreach($itemg['items'] as $item){ // block::whereId($item['value'])->update(['order' => $item['order']]); // } diff --git a/src/Livewire/BlocksTable.php b/src/Livewire/BlocksTable.php index e5583d9..26acb00 100644 --- a/src/Livewire/BlocksTable.php +++ b/src/Livewire/BlocksTable.php @@ -15,21 +15,37 @@ class BlocksTable extends Component use WithPagination; public $headers; + public $data; + public $action; + public $selectedItem; + public $FormDelete = false; + public $FormAdd = false; + public $FormEdit = false; + public $FormRegenerate = false; + public $regenerateId = null; + public $regenerateFileName = ''; + public $perPage = 10000; + public $search = ''; + public $orderBy = 'order'; + public $orderAsc = true; + public $blockarray; + public $name; + public $type; protected function rules(): array @@ -82,8 +98,12 @@ public function render() public function selectItem($itemId, $action) { $this->selectedItem = $itemId; - if ($action == 'add') $this->FormAdd = true; - if ($action == 'delete') $this->FormDelete = true; + if ($action == 'add') { + $this->FormAdd = true; + } + if ($action == 'delete') { + $this->FormDelete = true; + } } public function saveBlock() @@ -106,18 +126,18 @@ protected function createBlockViewFile(string $type): void File::ensureDirectoryExists(dirname($path)); - $stub = << '']) @php - \$cssclassname = get_meta(\$item, 'css-classname', ''); - // \$title = get_field('title', \$item->datafield); - // \$image = get_field('image', \$item->datafield); - // \$text = get_field('text', \$item->datafield); + $cssclassname = get_meta($item, 'css-classname', ''); + // $title = get_field('title', $item->datafield); + // $image = get_field('image', $item->datafield); + // $text = get_field('text', $item->datafield); @endphp -
- {{-- TODO: render fields from \$item->datafield --}} +
+ {{-- TODO: render fields from $item->datafield --}}
BLADE; @@ -166,9 +186,9 @@ public function regenerateViewFile(int $templateId): void return match ($field->type) { 'wysiwyg' => " \$_{$var} = wysiwyg_blocks(\$item, {$raw});", - 'link' => " \$_{$var}Raw = {$raw};\n \$_{$var} = is_array(\$_{$var}Raw) ? (object) \$_{$var}Raw : (is_string(\$_{$var}Raw) ? json_decode(\$_{$var}Raw) : null);", + 'link' => " \$_{$var}Raw = {$raw};\n \$_{$var} = is_array(\$_{$var}Raw) ? (object) \$_{$var}Raw : (is_string(\$_{$var}Raw) ? json_decode(\$_{$var}Raw) : null);", 'gallery' => " \$_{$var}Raw = {$raw};\n \$_{$var} = is_array(\$_{$var}Raw) ? \$_{$var}Raw : [];", - default => " \$_{$var} = {$raw};", + default => " \$_{$var} = {$raw};", }; })->implode("\n"); @@ -176,14 +196,14 @@ public function regenerateViewFile(int $templateId): void $var = $varMap[$field->name]; return match ($field->type) { - 'wysiwyg' => " {{-- wysiwyg: {$field->name} --}}\n @foreach (\$_{$var} as \$block)\n

{!! \$block['content'] ?? '' !!}

\n @endforeach", - 'image' => " {{-- image: {$field->name} --}}\n @if (\$_{$var})\n \n @endif", - 'gallery' => " {{-- gallery: {$field->name} --}}\n @foreach (\$_{$var} as \$_{$var}Id)\n \n @endforeach", - 'link' => " {{-- link: {$field->name} --}}\n @if (\$_{$var})\n url ?? '#' }}\" class=\"underline hover:no-underline\">\n {{ \$_{$var}->title ?? '{$field->name}' }}\n \n @endif", - 'file' => " {{-- file: {$field->name} --}}\n @if (\$_{$var})\n @php \$_fileModel = \\Secondnetwork\\Kompass\\Models\\File::find(\$_{$var}); @endphp\n @if (\$_fileModel)\n path . '/' . \$_fileModel->slug . '.' . \$_fileModel->extension) }}\" download>\n {{ \$_fileModel->name }}\n \n @endif\n @endif", + 'wysiwyg' => " {{-- wysiwyg: {$field->name} --}}\n @foreach (\$_{$var} as \$block)\n

{!! \$block['content'] ?? '' !!}

\n @endforeach", + 'image' => " {{-- image: {$field->name} --}}\n @if (\$_{$var})\n \n @endif", + 'gallery' => " {{-- gallery: {$field->name} --}}\n @foreach (\$_{$var} as \$_{$var}Id)\n \n @endforeach", + 'link' => " {{-- link: {$field->name} --}}\n @if (\$_{$var})\n url ?? '#' }}\" class=\"underline hover:no-underline\">\n {{ \$_{$var}->title ?? '{$field->name}' }}\n \n @endif", + 'file' => " {{-- file: {$field->name} --}}\n @if (\$_{$var})\n @php \$_fileModel = \\Secondnetwork\\Kompass\\Models\\File::find(\$_{$var}); @endphp\n @if (\$_fileModel)\n path . '/' . \$_fileModel->slug . '.' . \$_fileModel->extension) }}\" download>\n {{ \$_fileModel->name }}\n \n @endif\n @endif", 'true_false' => " {{-- true_false: {$field->name} --}}\n @if (\$_{$var})\n {{-- visible when active --}}\n @endif", - 'color' => " {{-- color: {$field->name} --}}\n @if (\$_{$var})\n
\n @endif", - default => " {{-- {$field->type}: {$field->name} --}}\n @if (\$_{$var})

{{ \$_{$var} }}

@endif", + 'color' => " {{-- color: {$field->name} --}}\n @if (\$_{$var})\n
\n @endif", + default => " {{-- {$field->type}: {$field->name} --}}\n @if (\$_{$var})

{{ \$_{$var} }}

@endif", }; })->implode("\n\n"); @@ -198,7 +218,10 @@ public function regenerateViewFile(int $templateId): void } } - public function updatedName($value) { $this->type = Str::slug($value); } + public function updatedName($value) + { + $this->type = Str::slug($value); + } public function delete() { @@ -210,11 +233,15 @@ public function handleSort($item, $position) { $blocks = Blocktemplates::orderBy('order', 'ASC')->get(); $movedItemIndex = $blocks->search(fn ($block) => $block->id == $item); - if ($movedItemIndex === false) return; + if ($movedItemIndex === false) { + return; + } $movedItem = $blocks->pull($movedItemIndex); $blocks->splice($position, 0, [$movedItem]); foreach ($blocks->values() as $index => $block) { - if ($block->order !== $index) $block->update(['order' => $index]); + if ($block->order !== $index) { + $block->update(['order' => $index]); + } } $this->call_emit_reset(); } @@ -222,12 +249,15 @@ public function handleSort($item, $position) public function sortBy($field) { if ($this->orderBy === $field) { - $this->orderAsc = !$this->orderAsc; + $this->orderAsc = ! $this->orderAsc; } else { $this->orderBy = $field; $this->orderAsc = true; } } - public function toJSON(): string { return '{}'; } + public function toJSON(): string + { + return '{}'; + } } diff --git a/src/Livewire/CategoryTable.php b/src/Livewire/CategoryTable.php index d5d2da6..be38401 100644 --- a/src/Livewire/CategoryTable.php +++ b/src/Livewire/CategoryTable.php @@ -2,13 +2,13 @@ namespace Secondnetwork\Kompass\Livewire; +use Illuminate\Support\Facades\File; use Illuminate\Support\Str; use Livewire\Attributes\Locked; use Livewire\Attributes\Url; use Livewire\Component; use Livewire\WithPagination; use Secondnetwork\Kompass\Models\Category; -use Illuminate\Support\Facades\File; class CategoryTable extends Component { @@ -24,23 +24,36 @@ class CategoryTable extends Component public $orderAsc = true; public $name; + public $slug; + public $description; + public $color = 'primary'; + public $icon = ''; + public $iconSearch = ''; + public $selectedIcon = ''; + public $filteredIcons = []; + public $order = 0; + public $perPage = 20; + public $headers; + public $data; #[Locked] public $selectedItem; public $FormDelete = false; + public $FormAdd = false; + public $FormEdit = false; protected function rules(): array @@ -57,7 +70,7 @@ protected function rules(): array protected function headerTable(): array { - return ['name', 'color', 'icon' ,'']; + return ['name', 'color', 'icon', '']; } protected function dataTable(): array @@ -76,7 +89,7 @@ private function getIconPath(): string { $possiblePaths = [ base_path('vendor/secondnetwork/blade-tabler-icons/resources/svg'), - dirname(base_path()) . '/vendor/secondnetwork/blade-tabler-icons/resources/svg', + dirname(base_path()).'/vendor/secondnetwork/blade-tabler-icons/resources/svg', public_path('vendor/blade-tabler-icons'), ]; @@ -94,33 +107,32 @@ public function loadIcons() $this->filteredIcons = []; $iconPath = $this->getIconPath(); - - if (empty($iconPath) || !is_dir($iconPath)) { + + if (empty($iconPath) || ! is_dir($iconPath)) { return; } try { $files = File::files($iconPath); - + if (empty($files)) { return; } - + $icons = collect($files) - ->map(fn($file) => str_replace('.svg', '', $file->getFilename())) + ->map(fn ($file) => str_replace('.svg', '', $file->getFilename())) ->sort() ->values(); if ($this->iconSearch) { $search = strtolower(trim($this->iconSearch)); - if (!empty($search)) { - $icons = $icons->filter(fn($name) => - str_contains(strtolower($name), $search) + if (! empty($search)) { + $icons = $icons->filter(fn ($name) => str_contains(strtolower($name), $search) ); } } - $this->filteredIcons = $icons->take(100)->map(fn($name) => [ + $this->filteredIcons = $icons->take(100)->map(fn ($name) => [ 'id' => $name, 'name' => $name, 'display' => $name, @@ -140,11 +152,11 @@ private function ensureIconPrefix($icon): string if (empty($icon)) { return ''; } - - if (!str_starts_with($icon, 'tabler-')) { - return 'tabler-' . $icon; + + if (! str_starts_with($icon, 'tabler-')) { + return 'tabler-'.$icon; } - + return $icon; } @@ -163,7 +175,7 @@ public function resetIcon() public function sortBy($field) { if ($this->orderBy === $field) { - $this->orderAsc = !$this->orderAsc; + $this->orderAsc = ! $this->orderAsc; } else { $this->orderBy = $field; $this->orderAsc = true; @@ -177,6 +189,7 @@ private function resultDate() $results->where('name', 'like', '%'.$this->search.'%') ->orWhere('slug', 'like', '%'.$this->search.'%'); } + return $results->orderBy($this->orderBy, $this->orderAsc ? 'ASC' : 'DESC')->paginate($this->perPage); } @@ -191,7 +204,9 @@ public function selectItem($itemId, $action) $this->FormEdit = true; $this->loadCategory($itemId); } - if ($action == 'delete') $this->FormDelete = true; + if ($action == 'delete') { + $this->FormDelete = true; + } } private function resetFields() diff --git a/src/Livewire/DatafieldItem.php b/src/Livewire/DatafieldItem.php index 5ff3671..b7d28cf 100644 --- a/src/Livewire/DatafieldItem.php +++ b/src/Livewire/DatafieldItem.php @@ -40,7 +40,7 @@ public function selectitem($action, $itemId, $fieldOrPageName = null, $blockgrou } - #[on('refreshmedia')] + #[On('refreshmedia')] public function reestPage() { // $this->FormMedia = false; @@ -52,7 +52,7 @@ public function removemedia($id) Datafield::whereId($id)->update(['data' => null]); } - #[on('saveTheDatafield')] + #[On('saveTheDatafield')] public function saveTheDatafield() { diff --git a/src/Livewire/EditableMeta.php b/src/Livewire/EditableMeta.php index 66eda81..fa97d87 100644 --- a/src/Livewire/EditableMeta.php +++ b/src/Livewire/EditableMeta.php @@ -2,8 +2,8 @@ namespace Secondnetwork\Kompass\Livewire; -use Secondnetwork\Kompass\Models\Meta; use Livewire\Component; +use Secondnetwork\Kompass\Models\Meta; class EditableMeta extends Component { diff --git a/src/Livewire/EditableName.php b/src/Livewire/EditableName.php index a9e8729..9bf4b72 100644 --- a/src/Livewire/EditableName.php +++ b/src/Livewire/EditableName.php @@ -26,7 +26,7 @@ public function toggleEditingState() { $this->isEditing = ! $this->isEditing; $this->dispatch('focus-input'); - + } public function savename() diff --git a/src/Livewire/FieldEditor.php b/src/Livewire/FieldEditor.php index faa9d92..0f9307d 100644 --- a/src/Livewire/FieldEditor.php +++ b/src/Livewire/FieldEditor.php @@ -2,22 +2,23 @@ namespace Secondnetwork\Kompass\Livewire; -use Livewire\Component; use Livewire\Attributes\On; +use Livewire\Component; use Secondnetwork\Kompass\Models\Blockfields; class FieldEditor extends Component { - public Blockfields $field; - public $name; + public $grid; + public $type; + public $selectedItem; - public $FormDelete = false; + public $FormDelete = false; protected function rules(): array { @@ -62,7 +63,7 @@ public function saveField() // Umbenannt von Upsave, kein Parameter ]); - session()->flash('message-field-' . $this->field->id, 'Feld gespeichert.'); + session()->flash('message-field-'.$this->field->id, 'Feld gespeichert.'); $this->dispatch('block-resetpage'); } diff --git a/src/Livewire/MediaComponents/MediaItem.php b/src/Livewire/MediaComponents/MediaItem.php index dfdce5e..1201e62 100644 --- a/src/Livewire/MediaComponents/MediaItem.php +++ b/src/Livewire/MediaComponents/MediaItem.php @@ -2,9 +2,9 @@ namespace Secondnetwork\Kompass\Livewire\MediaComponents; +use Livewire\Attributes\Locked; use Livewire\Component; use Secondnetwork\Kompass\Models\File; -use Livewire\Attributes\Locked; class MediaItem extends Component { @@ -29,7 +29,7 @@ public function selectField($fileId) public function goToFolder() { if ($this->file->type == 'folder') { - $full_path = ($this->file->path ? rtrim($this->file->path, '/') . '/' : '') . $this->file->slug; + $full_path = ($this->file->path ? rtrim($this->file->path, '/').'/' : '').$this->file->slug; $this->dispatch('go-to-folder', path: $full_path)->to('Secondnetwork\Kompass\Livewire\Medialibrary'); } } diff --git a/src/Livewire/MenuData.php b/src/Livewire/MenuData.php index ee1e06b..d134558 100644 --- a/src/Livewire/MenuData.php +++ b/src/Livewire/MenuData.php @@ -132,9 +132,7 @@ public function handleSort($item, $position, $groupId = null) public $timestamps = false; #[On('refreshComponentGroup')] - public function handleRefresh(): void - { - } + public function handleRefresh(): void {} protected function rules(): array { diff --git a/src/Livewire/MenuProfile.php b/src/Livewire/MenuProfile.php index a3e9388..814a59c 100644 --- a/src/Livewire/MenuProfile.php +++ b/src/Livewire/MenuProfile.php @@ -2,16 +2,13 @@ namespace Secondnetwork\Kompass\Livewire; -use Illuminate\Support\Facades\Auth; use Livewire\Attributes\On; use Livewire\Component; class MenuProfile extends Component { #[On('profile-updated')] - public function refresh(): void - { - } + public function refresh(): void {} public function render() { diff --git a/src/Livewire/MenuTable.php b/src/Livewire/MenuTable.php index 6f34e92..0e5bec5 100644 --- a/src/Livewire/MenuTable.php +++ b/src/Livewire/MenuTable.php @@ -4,24 +4,40 @@ use Livewire\Component; use Secondnetwork\Kompass\Models\Menu; +use Secondnetwork\Kompass\Models\Menuitem; class MenuTable extends Component { public $name; + public $group; + public $headers; + public $data; + public $newName; + public $land = ''; + public $available_locales; + public $selectedItem; + public $timestamps = false; + public $FormDelete = false; + public $FormAdd = false; + public $FormClone = false; + public $FormEdit = false; + public $cloneLand = ''; + public $orderBy = 'order'; + public $orderAsc = true; protected function rules(): array @@ -46,6 +62,7 @@ protected function headerTable(): array $headers[] = 'land'; } $headers[] = ''; + return $headers; } @@ -55,6 +72,7 @@ protected function dataTable(): array if (setting('global.multilingual')) { $data[] = 'land'; } + return $data; } @@ -71,15 +89,15 @@ public function mount() } $appLocale = config('app.locale', 'de'); - + // Move app locale to front if (($key = array_search($appLocale, $locales)) !== false) { unset($locales[$key]); array_unshift($locales, $appLocale); } - + $this->available_locales = $locales; - + if (empty($this->land) && session()->has('kompass_last_land')) { $this->land = session('kompass_last_land'); } @@ -88,8 +106,12 @@ public function mount() public function selectItem($itemId, $action) { $this->selectedItem = $itemId; - if ($action == 'add') $this->FormAdd = true; - if ($action == 'delete') $this->FormDelete = true; + if ($action == 'add') { + $this->FormAdd = true; + } + if ($action == 'delete') { + $this->FormDelete = true; + } if ($action == 'clone') { $this->FormClone = true; $this->cloneLand = Menu::find($itemId)->land ?? config('app.locale', 'de'); @@ -100,21 +122,21 @@ public function cloneMenu() { $id = $this->selectedItem; $originalMenu = Menu::findOrFail($id); - + $newMenu = $originalMenu->replicate(); - $newMenu->name = $originalMenu->name . ' (copy)'; + $newMenu->name = $originalMenu->name.' (copy)'; $newMenu->land = $this->cloneLand; $newMenu->push(); - $items = \Secondnetwork\Kompass\Models\Menuitem::where('menu_id', $id)->whereNull('subgroup')->get(); - + $items = Menuitem::where('menu_id', $id)->whereNull('subgroup')->get(); + foreach ($items as $item) { $newItem = $item->replicate(); $newItem->menu_id = $newMenu->id; $newItem->push(); // Handle children - $children = \Secondnetwork\Kompass\Models\Menuitem::where('subgroup', $item->id)->get(); + $children = Menuitem::where('subgroup', $item->id)->get(); foreach ($children as $child) { $newChild = $child->replicate(); $newChild->menu_id = $newMenu->id; @@ -124,6 +146,7 @@ public function cloneMenu() } $this->FormClone = false; + return redirect()->to('/admin/menus/show/'.$newMenu->id); } @@ -131,11 +154,12 @@ public function addMenu() { $this->validate(); $menu = Menu::create([ - 'name' => $this->name, + 'name' => $this->name, 'group' => $this->group, 'land' => $this->land ?: config('app.locale', 'de'), ]); $this->FormAdd = false; + return redirect()->to('/admin/menus/show/'.$menu->id); } @@ -173,11 +197,15 @@ public function handleSort($item, $position) { $menus = Menu::orderBy('order', 'ASC')->get(); $movedItemIndex = $menus->search(fn ($menu) => $menu->id == $item); - if ($movedItemIndex === false) return; + if ($movedItemIndex === false) { + return; + } $movedItem = $menus->pull($movedItemIndex); $menus->splice($position, 0, [$movedItem]); foreach ($menus->values() as $index => $menu) { - if ($menu->order !== $index) $menu->update(['order' => $index]); + if ($menu->order !== $index) { + $menu->update(['order' => $index]); + } } $this->call_emit_reset(); } @@ -192,7 +220,7 @@ public function updateMenusOrder($list) public function sortBy($field) { if ($this->orderBy === $field) { - $this->orderAsc = !$this->orderAsc; + $this->orderAsc = ! $this->orderAsc; } else { $this->orderBy = $field; $this->orderAsc = true; diff --git a/src/Livewire/Settings/ActivityLog.php b/src/Livewire/Settings/ActivityLog.php index 9aa66ec..f778d70 100644 --- a/src/Livewire/Settings/ActivityLog.php +++ b/src/Livewire/Settings/ActivityLog.php @@ -4,6 +4,7 @@ use Livewire\Component; use Livewire\WithPagination; +use Spatie\Activitylog\Models\Activity; class ActivityLog extends Component { @@ -16,7 +17,7 @@ class ActivityLog extends Component public function sortBy($field) { if ($this->orderBy === $field) { - $this->orderAsc = !$this->orderAsc; + $this->orderAsc = ! $this->orderAsc; } else { $this->orderBy = $field; $this->orderAsc = true; @@ -25,11 +26,11 @@ public function sortBy($field) public function render() { - if (!class_exists(\Spatie\Activitylog\Models\Activity::class)) { + if (! class_exists(Activity::class)) { return view('kompass::livewire.settings.activity-log', ['logsact' => collect()]); } - $logsact = \Spatie\Activitylog\Models\Activity::orderBy($this->orderBy, $this->orderAsc ? 'asc' : 'desc')->paginate(20); + $logsact = Activity::orderBy($this->orderBy, $this->orderAsc ? 'asc' : 'desc')->paginate(20); return view('kompass::livewire.settings.activity-log', ['logsact' => $logsact]); } diff --git a/src/Livewire/Settings/AdminPanel.php b/src/Livewire/Settings/AdminPanel.php index 7f99117..01b925b 100644 --- a/src/Livewire/Settings/AdminPanel.php +++ b/src/Livewire/Settings/AdminPanel.php @@ -2,19 +2,21 @@ namespace Secondnetwork\Kompass\Livewire\Settings; +use Illuminate\Support\Facades\Storage; +use Illuminate\Support\Str; +use Livewire\Attributes\Layout; use Livewire\Component; use Livewire\WithFileUploads; -use Illuminate\Support\Facades\Storage; use Secondnetwork\Kompass\Models\Setting; -use Livewire\Attributes\Layout; -use Illuminate\Support\Str; class AdminPanel extends Component { use WithFileUploads; public $logo; + public $newLogo; + public $copyright; public function mount() @@ -27,19 +29,19 @@ public function save() { if ($this->newLogo) { $extension = $this->newLogo->getClientOriginalExtension(); - $newFilename = 'logo.' . $extension; - + $newFilename = 'logo.'.$extension; + $path = $this->newLogo->storeAs('images', $newFilename, 'public'); $this->logo = Storage::disk('public')->url($path); } if ($this->logo) { - Setting::updateOrCreate( + Setting::updateOrCreate( ['key' => 'logo', 'group' => 'global'], ['data' => $this->logo, 'name' => 'Admin Logo', 'type' => 'image'] ); } - + if ($this->copyright) { Setting::updateOrCreate( ['key' => 'copyright', 'group' => 'global'], @@ -55,10 +57,10 @@ public function deleteLogo() $imagePath = $this->logo; if ($imagePath && Str::startsWith($imagePath, '/storage/')) { - $relativePath = str_replace('/storage/', '', $imagePath); - if (Storage::disk('public')->exists($relativePath)) { - Storage::disk('public')->delete($relativePath); - } + $relativePath = str_replace('/storage/', '', $imagePath); + if (Storage::disk('public')->exists($relativePath)) { + Storage::disk('public')->delete($relativePath); + } } $this->logo = ''; diff --git a/src/Livewire/Settings/Backendmenu.php b/src/Livewire/Settings/Backendmenu.php index 9b8e796..20c42d4 100644 --- a/src/Livewire/Settings/Backendmenu.php +++ b/src/Livewire/Settings/Backendmenu.php @@ -8,8 +8,11 @@ class Backendmenu extends Component { public $show_posts = true; + public $show_categories = true; + public $show_pages = true; + public $show_medialibrary = true; public function mount() @@ -47,4 +50,4 @@ public function render() { return view('kompass::livewire.settings.backendmenu'); } -} \ No newline at end of file +} diff --git a/src/Livewire/Settings/ErrorLog.php b/src/Livewire/Settings/ErrorLog.php index e865a46..e7bee7f 100644 --- a/src/Livewire/Settings/ErrorLog.php +++ b/src/Livewire/Settings/ErrorLog.php @@ -17,7 +17,7 @@ class ErrorLog extends Component public function sortBy($field) { if ($this->orderBy === $field) { - $this->orderAsc = !$this->orderAsc; + $this->orderAsc = ! $this->orderAsc; } else { $this->orderBy = $field; $this->orderAsc = true; diff --git a/src/Livewire/Settings/Multilingual.php b/src/Livewire/Settings/Multilingual.php index a83ba8f..46978e4 100644 --- a/src/Livewire/Settings/Multilingual.php +++ b/src/Livewire/Settings/Multilingual.php @@ -2,15 +2,18 @@ namespace Secondnetwork\Kompass\Livewire\Settings; +use Illuminate\Support\Facades\Cache; use Livewire\Component; use Secondnetwork\Kompass\Models\Setting; -use Illuminate\Support\Facades\Cache; class Multilingual extends Component { public $multilingual; + public $available_locales = []; + public $new_locale; + public $all_locales = [ ['name' => 'German', 'id' => 'de'], ['name' => 'English', 'id' => 'en'], @@ -54,7 +57,7 @@ public function mount() $globalSettings = Setting::global()->get()->keyBy('key'); $this->multilingual = (bool) optional($globalSettings->get('multilingual'))->data ?? false; - + $localesData = optional($globalSettings->get('available_locales'))->data; if ($localesData) { $this->available_locales = is_array($localesData) ? $localesData : json_decode($localesData, true); @@ -81,7 +84,7 @@ public function addLocale() public function removeLocale($locale) { - $this->available_locales = array_values(array_filter($this->available_locales, fn($l) => $l !== $locale)); + $this->available_locales = array_values(array_filter($this->available_locales, fn ($l) => $l !== $locale)); $this->saveLocales(); } diff --git a/src/Livewire/Settings/PageAppearance.php b/src/Livewire/Settings/PageAppearance.php index 340c825..e626c79 100644 --- a/src/Livewire/Settings/PageAppearance.php +++ b/src/Livewire/Settings/PageAppearance.php @@ -2,6 +2,4 @@ namespace Secondnetwork\Kompass\Livewire\Settings; -class PageAppearance -{ -} +class PageAppearance {} diff --git a/src/Livewire/Settings/PageInformation.php b/src/Livewire/Settings/PageInformation.php index 04ccf5f..cee6822 100644 --- a/src/Livewire/Settings/PageInformation.php +++ b/src/Livewire/Settings/PageInformation.php @@ -2,32 +2,40 @@ namespace Secondnetwork\Kompass\Livewire\Settings; -use Secondnetwork\Kompass\Models\Setting; use Illuminate\Support\Facades\Storage; +use Illuminate\Support\Str; use Livewire\Attributes\On; use Livewire\Component; +use Livewire\Features\SupportFileUploads\TemporaryUploadedFile; use Livewire\WithFileUploads; -use Illuminate\Support\Str; // Import Str for startsWith +use Secondnetwork\Kompass\Models\Setting; + + // Import Str for startsWith class PageInformation extends Component { use WithFileUploads; public $webtitle; + public $supline; + public $description; + public $image; + public $footer_textarea; + public $email_address; + public $phone; + public $copyright; private $imageKey = 'ogimage_src'; #[On('component:refresh')] - public function handleRefresh(): void - { - } + public function handleRefresh(): void {} public function mount() { @@ -47,19 +55,20 @@ public function mount() public function updating($property, $value) { if ($property == 'image') { - if ($value instanceof \Livewire\Features\SupportFileUploads\TemporaryUploadedFile) { - $filename = $value->getClientOriginalName(); - $extension = $value->getClientOriginalExtension(); - $newFilename = 'ogimage.' . $extension; + if ($value instanceof TemporaryUploadedFile) { + $filename = $value->getClientOriginalName(); + $extension = $value->getClientOriginalExtension(); + $newFilename = 'ogimage.'.$extension; - $path = $value->storeAs('images', $newFilename, 'public'); + $path = $value->storeAs('images', $newFilename, 'public'); - $publicPath = Storage::disk('public')->url($path); + $publicPath = Storage::disk('public')->url($path); - $this->image = $publicPath; + $this->image = $publicPath; - $this->updateSettingInDatabase($this->imageKey, $publicPath); + $this->updateSettingInDatabase($this->imageKey, $publicPath); } + return; } @@ -85,21 +94,21 @@ public function deleteImage() $imagePath = $this->image; if ($imagePath && Str::startsWith($imagePath, '/storage/')) { - $relativePath = str_replace('/storage/', '', $imagePath); - if (Storage::disk('public')->exists($relativePath)) { - Storage::disk('public')->delete($relativePath); - } + $relativePath = str_replace('/storage/', '', $imagePath); + if (Storage::disk('public')->exists($relativePath)) { + Storage::disk('public')->delete($relativePath); + } } $this->updateSettingInDatabase($this->imageKey, ''); $this->image = ''; - //$this->js('savedMessageOpen()'); + // $this->js('savedMessageOpen()'); } public function render() { return view('kompass::livewire.settings.page-information'); } -} \ No newline at end of file +} diff --git a/src/Livewire/Setup/Alignment.php b/src/Livewire/Setup/Alignment.php index 4826eed..18384c9 100644 --- a/src/Livewire/Setup/Alignment.php +++ b/src/Livewire/Setup/Alignment.php @@ -39,7 +39,7 @@ private function updateConfigKeyValue($key, $value) { \Config::write('kompass.appearance.'.$key, $value); Artisan::call('config:clear'); - // $this->js('savedMessageOpen()'); + // $this->js('savedMessageOpen()'); } public function render() diff --git a/src/Livewire/Setup/Color.php b/src/Livewire/Setup/Color.php index e599342..c808fdc 100644 --- a/src/Livewire/Setup/Color.php +++ b/src/Livewire/Setup/Color.php @@ -11,18 +11,25 @@ class Color extends Component use WithFileUploads; public $text_color; + public $button_color; + public $button_text_color; + public $input_text_color; + public $input_border_color; // Definiere die Datenbank-Keys private $dbKeyTextColor = 'color_text'; + private $dbKeyButtonColor = 'color_button'; + private $dbKeyButtonTextColor = 'color_button_text'; + private $dbKeyInputTextColor = 'color_input_text'; - private $dbKeyInputBorderColor = 'color_input_border'; + private $dbKeyInputBorderColor = 'color_input_border'; public function mount() { @@ -79,4 +86,4 @@ public function render() { return view('kompass::livewire.setup.color'); } -} \ No newline at end of file +} diff --git a/src/Livewire/Setup/Favicon.php b/src/Livewire/Setup/Favicon.php index 231383e..9321c00 100644 --- a/src/Livewire/Setup/Favicon.php +++ b/src/Livewire/Setup/Favicon.php @@ -2,23 +2,27 @@ namespace Secondnetwork\Kompass\Livewire\Setup; +use Illuminate\Support\Facades\Storage; +use Illuminate\Support\Str; use Livewire\Component; use Livewire\WithFileUploads; -use Illuminate\Support\Facades\Storage; use Secondnetwork\Kompass\Features\FaviconGenerator; use Secondnetwork\Kompass\Models\Setting; -use Illuminate\Support\Str; class Favicon extends Component { use WithFileUploads; public $favicon_light; + public $favicon_dark; + public $color_theme; private $dbKeyFaviconLight = 'favicon_light_image_path'; + private $dbKeyFaviconDark = 'favicon_dark_image_path'; + private $dbKeyColorTheme = 'favicon_theme_color'; public function mount() @@ -63,7 +67,7 @@ public function updated($property, $value) $this->favicon_dark = '/storage/favicon/'.$newFilename; $this->updateSettingInDatabase($this->dbKeyFaviconDark, '/storage/favicon/'.$newFilename); - + $storage->put('favicon/'.$newFilename, $value->get()); $value = null; @@ -96,10 +100,10 @@ private function updateSettingInDatabase($key, $value) private function deleteFaviconFile(?string $publicPath) { if ($publicPath && Str::startsWith($publicPath, '/storage/')) { - $relativePath = str_replace('/storage/', '', $publicPath); - if (Storage::disk('public')->exists($relativePath)) { - Storage::disk('public')->delete($relativePath); - } + $relativePath = str_replace('/storage/', '', $publicPath); + if (Storage::disk('public')->exists($relativePath)) { + Storage::disk('public')->delete($relativePath); + } } } @@ -110,7 +114,7 @@ public function deleteFaviconLight() $this->favicon_light = ''; } - public function deleteFaviconDark() + public function deleteFaviconDark() { $this->deleteFaviconFile($this->favicon_dark); $this->updateSettingInDatabase($this->dbKeyFaviconDark, ''); diff --git a/src/Livewire/Setup/Logo.php b/src/Livewire/Setup/Logo.php index 88e5885..c8dd4e9 100644 --- a/src/Livewire/Setup/Logo.php +++ b/src/Livewire/Setup/Logo.php @@ -2,25 +2,34 @@ namespace Secondnetwork\Kompass\Livewire\Setup; +use Illuminate\Support\Facades\Log; +use Illuminate\Support\Facades\Storage; +use Illuminate\Support\Str; use Livewire\Component; +use Livewire\Features\SupportFileUploads\TemporaryUploadedFile; use Livewire\WithFileUploads; -use Illuminate\Support\Facades\Storage; use Secondnetwork\Kompass\Models\Setting; -use Illuminate\Support\Str; class Logo extends Component { use WithFileUploads; public $logo_type; + public $logo_image_src; + public $logo_svg_string; + public $logo_height; + public $logo_image; private $dbKeyLogoType = 'logo_type'; + private $dbKeyLogoImageSrc = 'logo_image_src'; + private $dbKeyLogoSvgString = 'logo_svg_string'; + private $dbKeyLogoHeight = 'logo_height'; public function mount() @@ -35,28 +44,28 @@ public function mount() public function saveSvg() { - \Illuminate\Support\Facades\Log::info('saveSvg called, string: ' . $this->logo_svg_string); + Log::info('saveSvg called, string: '.$this->logo_svg_string); $this->updateSettingInDatabase($this->dbKeyLogoSvgString, $this->logo_svg_string); $this->logo_type = 'svg'; $this->updateSettingInDatabase($this->dbKeyLogoType, 'svg'); - + session()->flash('message', 'SVG erfolgreich gespeichert.'); } public function updatedLogoImage() { - if ($this->logo_image instanceof \Livewire\Features\SupportFileUploads\TemporaryUploadedFile) { + if ($this->logo_image instanceof TemporaryUploadedFile) { $this->deleteLogoImageFile($this->logo_image_src); $extension = $this->logo_image->getClientOriginalExtension(); - $newFilename = 'logo.' . $extension; + $newFilename = 'logo.'.$extension; $path = $this->logo_image->storeAs('images/logo', $newFilename, 'public'); $publicPath = Storage::disk('public')->url($path); $this->logo_image_src = $publicPath; $this->updateSettingInDatabase($this->dbKeyLogoImageSrc, $publicPath); - + $this->logo_type = 'image'; $this->updateSettingInDatabase($this->dbKeyLogoType, 'image'); } @@ -89,10 +98,10 @@ private function updateSettingInDatabase($key, $value) private function deleteLogoImageFile(?string $publicPath) { if ($publicPath && Str::startsWith($publicPath, '/storage/')) { - $relativePath = str_replace('/storage/', '', $publicPath); - if (Storage::disk('public')->exists($relativePath)) { - Storage::disk('public')->delete($relativePath); - } + $relativePath = str_replace('/storage/', '', $publicPath); + if (Storage::disk('public')->exists($relativePath)) { + Storage::disk('public')->delete($relativePath); + } } } @@ -108,4 +117,4 @@ public function render() { return view('kompass::livewire.setup.logo'); } -} \ No newline at end of file +} diff --git a/src/Models/Menu.php b/src/Models/Menu.php index f54a20d..d4f6154 100644 --- a/src/Models/Menu.php +++ b/src/Models/Menu.php @@ -44,7 +44,7 @@ protected static function boot() private function createSlug($anme) { - $businessNameURL = Str::slug($anme, '-', 'de'); //Convert Input to Str Slug + $businessNameURL = Str::slug($anme, '-', 'de'); // Convert Input to Str Slug $placeObj = new Page; @@ -52,7 +52,7 @@ private function createSlug($anme) if ($this->land) { $query->where('land', $this->land); } - + $checkSlug = $query->exists(); if ($checkSlug) { @@ -60,19 +60,19 @@ private function createSlug($anme) while (1) { $newSlug = $businessNameURL.'-'.$numericalPrefix++; $newSlug = Str::slug($newSlug, '-', 'de'); - + $query = static::whereSlug($newSlug); if ($this->land) { $query->where('land', $this->land); } - + if (! $query->exists()) { - return $newSlug; //New Slug + return $newSlug; // New Slug } } } - //Slug do not exists. Just use the selected Slug. + // Slug do not exists. Just use the selected Slug. return $businessNameURL; } } diff --git a/src/Models/Page.php b/src/Models/Page.php index d0aa7b5..7659071 100644 --- a/src/Models/Page.php +++ b/src/Models/Page.php @@ -13,8 +13,8 @@ class Page extends Model { use HasFactory; use HasMeta; - use SoftDeletes; use LogsActivity; + use SoftDeletes; protected $casts = [ 'content' => 'array', diff --git a/src/Notifications/ResetPassword.php b/src/Notifications/ResetPassword.php index f04575e..8801c4f 100644 --- a/src/Notifications/ResetPassword.php +++ b/src/Notifications/ResetPassword.php @@ -2,6 +2,7 @@ namespace Illuminate\Auth\Notifications; +use Illuminate\Notifications\Messages\MailMessage; use Illuminate\Notifications\Notification; class ResetPassword extends Notification @@ -53,7 +54,7 @@ public function via($notifiable) * Build the mail representation of the notification. * * @param mixed $notifiable - * @return \Illuminate\Notifications\Messages\MailMessage + * @return MailMessage */ public function toMail($notifiable) { diff --git a/src/Notifications/VerifyEmail.php b/src/Notifications/VerifyEmail.php index 7a5cf91..6e0fbd0 100644 --- a/src/Notifications/VerifyEmail.php +++ b/src/Notifications/VerifyEmail.php @@ -40,7 +40,7 @@ public function via($notifiable) * Build the mail representation of the notification. * * @param mixed $notifiable - * @return \Illuminate\Notifications\Messages\MailMessage + * @return MailMessage */ public function toMail($notifiable) { @@ -57,7 +57,7 @@ public function toMail($notifiable) * Get the verify email notification mail message for the given URL. * * @param string $url - * @return \Illuminate\Notifications\Messages\MailMessage + * @return MailMessage */ protected function buildMailMessage($url) { diff --git a/src/Traits/LogsActivity.php b/src/Traits/LogsActivity.php index 2b789c0..81bc12a 100644 --- a/src/Traits/LogsActivity.php +++ b/src/Traits/LogsActivity.php @@ -2,7 +2,7 @@ namespace Secondnetwork\Kompass\Traits; -use Illuminate\Support\Str; +use Spatie\Activitylog\Support\LogOptions; trait LogsActivity { @@ -16,7 +16,7 @@ public static function bootLogsActivity(): void if (class_exists(\Spatie\Activitylog\Models\Concerns\LogsActivity::class)) { $class = static::class; $class::macro('getActivitylogOptions', function () { - return \Spatie\Activitylog\Support\LogOptions::defaults() + return LogOptions::defaults() ->logAll(); }); } diff --git a/src/database/factories/UserFactory.php b/src/database/factories/UserFactory.php index 3008492..395d40b 100644 --- a/src/database/factories/UserFactory.php +++ b/src/database/factories/UserFactory.php @@ -38,7 +38,7 @@ public function definition() /** * Indicate that the model's email address should be unverified. * - * @return \Illuminate\Database\Eloquent\Factories\Factory + * @return Factory */ public function unverified() { diff --git a/src/database/migrations/2022_10_14_094240_create_meta_table.php b/src/database/migrations/2022_10_14_094240_create_meta_table.php index d3a33a3..6793209 100644 --- a/src/database/migrations/2022_10_14_094240_create_meta_table.php +++ b/src/database/migrations/2022_10_14_094240_create_meta_table.php @@ -34,7 +34,7 @@ protected function addKeys(Blueprint &$table): void public function up(): void { - if (!Schema::hasTable('meta')) { + if (! Schema::hasTable('meta')) { Schema::create('meta', function (Blueprint $table): void { $this->addKeys($table); diff --git a/src/database/migrations/2024_08_02_092533_create_permission_tables.php b/src/database/migrations/2024_08_02_092533_create_permission_tables.php index 32a6eff..c8c4e0b 100644 --- a/src/database/migrations/2024_08_02_092533_create_permission_tables.php +++ b/src/database/migrations/2024_08_02_092533_create_permission_tables.php @@ -19,10 +19,10 @@ public function up(): void $pivotPermission = $columnNames['permission_pivot_key'] ?? 'permission_id'; if (empty($tableNames)) { - throw new \Exception('Error: config/permission.php not loaded. Run [php artisan config:clear] and try again.'); + throw new Exception('Error: config/permission.php not loaded. Run [php artisan config:clear] and try again.'); } if ($teams && empty($columnNames['team_foreign_key'] ?? null)) { - throw new \Exception('Error: team_foreign_key on config/permission.php not loaded. Run [php artisan config:clear] and try again.'); + throw new Exception('Error: team_foreign_key on config/permission.php not loaded. Run [php artisan config:clear] and try again.'); } Schema::create($tableNames['permissions'], function (Blueprint $table): void { @@ -136,7 +136,7 @@ public function down(): void $tableNames = config('permission.table_names'); if (empty($tableNames)) { - throw new \Exception('Error: config/permission.php not found and defaults could not be merged. Please publish the package configuration before proceeding, or drop the tables manually.'); + throw new Exception('Error: config/permission.php not found and defaults could not be merged. Please publish the package configuration before proceeding, or drop the tables manually.'); } Schema::drop($tableNames['role_has_permissions']); diff --git a/src/database/migrations/2024_11_22_135851_create_activity_log_table.php b/src/database/migrations/2024_11_22_135851_create_activity_log_table.php index 71294b6..5c17c24 100644 --- a/src/database/migrations/2024_11_22_135851_create_activity_log_table.php +++ b/src/database/migrations/2024_11_22_135851_create_activity_log_table.php @@ -20,4 +20,4 @@ public function up(): void $table->timestamps(); }); } -}; \ No newline at end of file +}; diff --git a/src/database/seeders/PostSeeder.php b/src/database/seeders/PostSeeder.php index 118c46e..c845d9d 100644 --- a/src/database/seeders/PostSeeder.php +++ b/src/database/seeders/PostSeeder.php @@ -2,11 +2,11 @@ namespace Database\Seeders; +use Faker\Factory as Faker; use Illuminate\Database\Seeder; -use Secondnetwork\Kompass\Models\Post; -use Secondnetwork\Kompass\Models\Datafield; use Illuminate\Support\Str; -use Faker\Factory as Faker; +use Secondnetwork\Kompass\Models\Datafield; +use Secondnetwork\Kompass\Models\Post; class PostSeeder extends Seeder { @@ -17,15 +17,15 @@ public function run(): void // 1. Tech-Schlagwörter definieren $techTopics = ['Laravel', 'React', 'Vue.js', 'Docker', 'Kubernetes', 'AWS', 'AI', 'ChatGPT', 'Tailwind CSS', 'PHP 8.2', 'MySQL', 'API Design']; $adjectives = ['Advanced', 'Beginner Guide to', 'The Future of', 'Scaling', 'Refactoring', 'Deploying', 'Understanding', 'Mastering']; - + for ($i = 0; $i < 10; $i++) { - + // 2. Zufälligen Tech-Titel bauen (z.B. "Mastering Laravel") $topic = $faker->randomElement($techTopics); - $title = $faker->randomElement($adjectives) . ' ' . $topic; - + $title = $faker->randomElement($adjectives).' '.$topic; + // Slug erstellen - $slug = Str::slug($title) . '-' . ($i + 1); + $slug = Str::slug($title).'-'.($i + 1); // Post erstellen $post = Post::create([ @@ -50,40 +50,40 @@ public function run(): void // 3. Tech-Content simulieren (JSON) // Wir fügen Code-Beispiele oder technische Begriffe in den Text ein $wysiwygData = [ - "time" => now()->timestamp * 1000, - "blocks" => [ + 'time' => now()->timestamp * 1000, + 'blocks' => [ [ - "id" => Str::random(10), - "type" => "header", - "data" => [ - "text" => "Why use " . $topic . "?", - "level" => 2 - ] + 'id' => Str::random(10), + 'type' => 'header', + 'data' => [ + 'text' => 'Why use '.$topic.'?', + 'level' => 2, + ], ], [ - "id" => Str::random(10), - "type" => "paragraph", - "data" => [ - "text" => "When working with $topic, developers often face challenges regarding scalability and performance. " . $faker->paragraph(3) - ] + 'id' => Str::random(10), + 'type' => 'paragraph', + 'data' => [ + 'text' => "When working with $topic, developers often face challenges regarding scalability and performance. ".$faker->paragraph(3), + ], ], [ - "id" => Str::random(10), - "type" => "header", // Zwischenüberschrift - "data" => [ - "text" => "Installation and Setup", - "level" => 3 - ] + 'id' => Str::random(10), + 'type' => 'header', // Zwischenüberschrift + 'data' => [ + 'text' => 'Installation and Setup', + 'level' => 3, + ], ], [ - "id" => Str::random(10), - "type" => "paragraph", - "data" => [ - "text" => "To get started, make sure your environment is ready. " . $faker->sentence(10) - ] - ] + 'id' => Str::random(10), + 'type' => 'paragraph', + 'data' => [ + 'text' => 'To get started, make sure your environment is ready. '.$faker->sentence(10), + ], + ], ], - "version" => "2.28.0" + 'version' => '2.28.0', ]; Datafield::create([ @@ -94,4 +94,4 @@ public function run(): void ]); } } -} \ No newline at end of file +} diff --git a/stubs/app/Http/Controllers/Auth/VerifyEmailController.php b/stubs/app/Http/Controllers/Auth/VerifyEmailController.php index a300bfa..bfeef5a 100644 --- a/stubs/app/Http/Controllers/Auth/VerifyEmailController.php +++ b/stubs/app/Http/Controllers/Auth/VerifyEmailController.php @@ -4,6 +4,7 @@ use App\Http\Controllers\Controller; use Illuminate\Auth\Events\Verified; +use Illuminate\Contracts\Auth\MustVerifyEmail; use Illuminate\Foundation\Auth\EmailVerificationRequest; use Illuminate\Http\RedirectResponse; @@ -19,7 +20,7 @@ public function __invoke(EmailVerificationRequest $request): RedirectResponse } if ($request->user()->markEmailAsVerified()) { - /** @var \Illuminate\Contracts\Auth\MustVerifyEmail $user */ + /** @var MustVerifyEmail $user */ $user = $request->user(); event(new Verified($user)); diff --git a/stubs/resources/views/pages/blog/single/single.php b/stubs/resources/views/pages/blog/single/single.php index 730f64f..f9ee6a2 100644 --- a/stubs/resources/views/pages/blog/single/single.php +++ b/stubs/resources/views/pages/blog/single/single.php @@ -2,8 +2,8 @@ use Illuminate\Http\Exceptions\HttpResponseException; use Illuminate\Http\RedirectResponse; -use Illuminate\Support\Arr; use Illuminate\Http\Request; +use Illuminate\Support\Arr; use Illuminate\Support\Facades\Cache; use Laravel\Head\Enums\OgType; use Laravel\Head\Facades\Head; diff --git a/stubs/routes/web.php b/stubs/routes/web.php index 5f55ef8..61d382a 100644 --- a/stubs/routes/web.php +++ b/stubs/routes/web.php @@ -17,16 +17,16 @@ Route::group(['middleware' => ['web']], function () use ($localePattern): void { Route::livewire('/', 'pages::page'); - + Route::livewire('/blog', 'pages::blog.index'); Route::livewire('/blog/{slug}', 'pages::blog.single'); - + if (setting('global.multilingual') && $localePattern) { Route::livewire('/{locale}/blog', 'pages::blog.index')->where('locale', $localePattern); Route::livewire('/{locale}/blog/{slug}', 'pages::blog.single')->where('locale', $localePattern); Route::livewire('/{locale}/{slug}', 'pages::page')->where('locale', $localePattern); Route::livewire('/{locale}', 'pages::page')->where('locale', $localePattern); } - + Route::livewire('/{slug}', 'pages::page'); });