From 5a2396d98483a4ff5e5096d2f96389a4a95dd05d Mon Sep 17 00:00:00 2001
From: "google-labs-jules[bot]"
<161369871+google-labs-jules[bot]@users.noreply.github.com>
Date: Sun, 22 Mar 2026 11:28:52 +0000
Subject: [PATCH 1/3] feat: Add captcha settings
- Register `captcha`, `captcha_site_key`, and `captcha_site_secret` settings
- Add settings UI for reCAPTCHA v2 Invisible
- Update Auth views and validators to use the settings while retaining backward compatibility
Co-authored-by: juzaweb <47020363+juzaweb@users.noreply.github.com>
---
src/Http/Middleware/Captcha.php | 12 +-
src/Providers/AdminServiceProvider.php | 4 +
src/Providers/AdminServiceProvider.php.orig | 338 ++++++++++++++++++
src/Rules/ReCaptchaValidator.php | 4 +-
.../views/admin/setting/index.blade.php | 23 ++
.../views/admin/setting/index.blade.php.orig | 186 ++++++++++
src/resources/views/layouts/auth.blade.php | 11 +-
7 files changed, 573 insertions(+), 5 deletions(-)
create mode 100644 src/Providers/AdminServiceProvider.php.orig
create mode 100644 src/resources/views/admin/setting/index.blade.php.orig
diff --git a/src/Http/Middleware/Captcha.php b/src/Http/Middleware/Captcha.php
index eb5a6031..c4c7b55f 100644
--- a/src/Http/Middleware/Captcha.php
+++ b/src/Http/Middleware/Captcha.php
@@ -20,13 +20,21 @@ class Captcha
public function handle($request, Closure $next)
{
- if (config('network.recaptcha.site_key')) {
+ $captcha = setting('captcha');
+ $siteKey = setting('captcha_site_key') ?: config('network.recaptcha.site_key');
+ $secretKey = setting('captcha_site_secret') ?: config('network.recaptcha.secret_key');
+
+ if (is_null($captcha) && $siteKey) {
+ $captcha = 'recaptcha';
+ }
+
+ if ($captcha == 'recaptcha' && $siteKey) {
$client = new Client(['connect_timeout' => 10, 'timeout' => 10]);
$response = $client->post(
'https://www.google.com/recaptcha/api/siteverify',
[
'form_params' => [
- 'secret' => config('network.recaptcha.secret_key'),
+ 'secret' => $secretKey,
'response' => $request->input('g-recaptcha-response'),
],
]
diff --git a/src/Providers/AdminServiceProvider.php b/src/Providers/AdminServiceProvider.php
index d54d25eb..2ed57b21 100644
--- a/src/Providers/AdminServiceProvider.php
+++ b/src/Providers/AdminServiceProvider.php
@@ -293,6 +293,10 @@ function () {
// Cookie Consent Settings
Setting::make('cookie_consent_enabled')->default(false);
Setting::make('cookie_consent_message')->rules(['nullable', 'string']);
+
+ Setting::make('captcha')->rules(['nullable', 'string']);
+ Setting::make('captcha_site_key')->rules(['nullable', 'string']);
+ Setting::make('captcha_site_secret')->rules(['nullable', 'string']);
}
);
}
diff --git a/src/Providers/AdminServiceProvider.php.orig b/src/Providers/AdminServiceProvider.php.orig
new file mode 100644
index 00000000..d54d25eb
--- /dev/null
+++ b/src/Providers/AdminServiceProvider.php.orig
@@ -0,0 +1,338 @@
+registerSettings();
+ $this->registerCharts();
+ $this->registerGlobalPageBlocks();
+ $this->registerGlobalWidgets();
+
+ $this->app[Sitemap::class]->register('pages', PageTranslation::class);
+
+ $this->registerMenus();
+
+ $this->registerMenuBoxs();
+ }
+
+ public function register(): void
+ {
+ //
+ }
+
+ protected function registerMenus(): void
+ {
+ Menu::make('dashboard', function () {
+ return [
+ 'title' => __('core::translation.dashboard'),
+ 'icon' => 'fas fa-tachometer-alt',
+ 'permission' => ['dashboard.index'],
+ ];
+ });
+
+ Menu::make('media', function () {
+ return [
+ 'title' => __('core::translation.media'),
+ 'icon' => 'fas fa-photo-video',
+ 'permission' => ['media.index'],
+ ];
+ });
+
+ Menu::make('pages', function () {
+ return [
+ 'title' => __('core::translation.pages'),
+ 'icon' => 'fas fa-layer-group',
+ 'permission' => ['pages.index'],
+ ];
+ });
+
+ Menu::make('appearance', function () {
+ return [
+ 'title' => __('core::translation.appearance'),
+ 'icon' => 'fas fa-paint-roller',
+ 'priority' => 80,
+ ];
+ });
+
+ Menu::make('themes', function () {
+ return [
+ 'title' => __('core::translation.themes'),
+ 'parent' => 'appearance',
+ 'permission' => ['themes.index'],
+ ];
+ });
+
+ Menu::make('widgets', function () {
+ return [
+ 'title' => __('core::translation.widgets'),
+ 'parent' => 'appearance',
+ 'permission' => ['themes.index'],
+ ];
+ });
+
+ Menu::make('menus', function () {
+ return [
+ 'title' => __('core::translation.menus'),
+ 'parent' => 'appearance',
+ 'permission' => ['menus.index'],
+ ];
+ });
+
+ Menu::make('modules', function () {
+ return [
+ 'title' => __('core::translation.modules'),
+ 'icon' => 'fas fa-cubes',
+ 'priority' => 90,
+ 'permission' => ['modules.index'],
+ ];
+ });
+
+ Menu::make('settings', function () {
+ return [
+ 'title' => __('core::translation.settings'),
+ 'icon' => 'fas fa-cogs',
+ 'priority' => 99,
+ ];
+ });
+
+ Menu::make('general', function () {
+ return [
+ 'title' => __('core::translation.general'),
+ 'url' => 'settings/general',
+ 'parent' => 'settings',
+ 'permission' => ['settings.general.edit'],
+ ];
+ });
+
+ Menu::make('social-login', function () {
+ return [
+ 'title' => __('core::translation.social_login'),
+ 'url' => 'settings/social-login',
+ 'parent' => 'settings',
+ 'permission' => ['settings.social-login.index'],
+ ];
+ });
+
+ Menu::make('email', function () {
+ return [
+ 'title' => __('core::translation.email'),
+ 'url' => 'settings/email',
+ 'parent' => 'settings',
+ 'permission' => ['settings.email.index'],
+ ];
+ });
+
+ Menu::make('users-roles', function () {
+ return [
+ 'title' => __('Users and Roles'),
+ 'priority' => 90,
+ 'icon' => 'fas fa-users-cog',
+ ];
+ });
+
+ Menu::make('users', function () {
+ return [
+ 'title' => __('core::translation.users'),
+ 'parent' => 'users-roles',
+ 'permission' => ['users.index'],
+ ];
+ });
+
+ Menu::make('roles', function () {
+ return [
+ 'title' => __('core::translation.roles'),
+ 'parent' => 'users-roles',
+ 'permission' => ['roles.index'],
+ ];
+ });
+
+ Menu::make('languages', function () {
+ return [
+ 'title' => __('core::translation.languages'),
+ 'parent' => 'settings',
+ 'permission' => ['languages.index'],
+ ];
+ });
+
+ Menu::make('profile', function () {
+ return [
+ 'title' => __('core::translation.profile'),
+ 'icon' => 'fas fa-user-cog',
+ 'url' => 'profile',
+ 'position' => 'admin-top-profile',
+ 'priority' => 10,
+ ];
+ });
+
+ Menu::make('profile-sidebar-info', function () {
+ return [
+ 'title' => __('core::translation.profile'),
+ 'icon' => 'fas fa-user',
+ 'url' => 'profile',
+ 'position' => 'admin-sidebar-profile',
+ 'priority' => 10,
+ ];
+ });
+
+ Menu::make('profile-sidebar-notifications', function () {
+ return [
+ 'title' => __('core::translation.notifications'),
+ 'icon' => 'fas fa-bell',
+ 'url' => 'profile/notifications',
+ 'position' => 'admin-sidebar-profile',
+ 'priority' => 20,
+ ];
+ });
+
+ Menu::make('log-viewer', function () {
+ if (! is_super_admin()) {
+ return [];
+ }
+
+ return [
+ 'title' => __('core::translation.log_view'),
+ 'icon' => 'fas fa-file-alt',
+ 'url' => 'log-viewer',
+ 'prefix' => '',
+ 'permission' => 'log-viewer.index',
+ 'priority' => 999,
+ 'target' => '_blank',
+ ];
+ });
+ }
+
+ protected function registerMenuBoxs(): void
+ {
+ MenuBox::make('pages', Page::class, function () {
+ return [
+ 'label' => __('core::translation.pages'),
+ 'icon' => 'fas fa-layer-group',
+ 'priority' => 1,
+ 'field' => 'title',
+ ];
+ });
+ }
+
+ protected function registerSettings(): void
+ {
+ $this->booted(
+ function () {
+ Setting::make('title')->default(config('app.name'));
+
+ Setting::make('description');
+ Setting::make('sitename');
+
+ Setting::make('logo');
+ Setting::make('favicon');
+ Setting::make('banner');
+
+ Setting::make('user_registration')->default(true);
+
+ Setting::make('user_verification')->default(false);
+
+ Setting::make('multiple_language')->default('none');
+ Setting::make('language')->default('en');
+
+ // Social Login Settings
+ $drivers = array_keys(config('core.social_login.providers', []));
+
+ foreach ($drivers as $driver) {
+ Setting::make("{$driver}_login")
+ ->add();
+
+ Setting::make("{$driver}_client_id")
+ ->add();
+
+ Setting::make("{$driver}_client_secret")
+ ->add();
+ }
+
+ Setting::make('mail_host')->rules(['nullable', 'string']);
+ Setting::make('mail_port')->rules(['nullable', 'integer', 'min:1', 'max:65535']);
+ Setting::make('mail_username')->rules(['nullable', 'string']);
+ Setting::make('mail_password')->rules(['nullable', 'string']);
+ Setting::make('mail_encryption')->rules(['nullable', 'string', 'in:tls,ssl']);
+ Setting::make('mail_from_address')->rules(['nullable', 'email']);
+ Setting::make('mail_from_name')->rules(['nullable', 'string']);
+
+ // Custom Scripts Settings
+ Setting::make('custom_header_script')->rules(['nullable', 'string']);
+ Setting::make('custom_footer_script')->rules(['nullable', 'string']);
+
+ Setting::make('google_analytics_id')->rules(['nullable', 'string']);
+
+ // Cookie Consent Settings
+ Setting::make('cookie_consent_enabled')->default(false);
+ Setting::make('cookie_consent_message')->rules(['nullable', 'string']);
+ }
+ );
+ }
+
+ protected function registerCharts(): void
+ {
+ Chart::chart('users', UsersChart::class);
+ Chart::chart('users-by-country', UsersByCountryChart::class);
+ Chart::chart('sessions-by-device', SessionsByDeviceChart::class);
+ Chart::chart('top-pages', TopPagesChart::class);
+ Chart::chart('session-duration', SessionDurationChart::class);
+ Chart::chart('traffic-sources', TrafficSourcesChart::class);
+ }
+
+ protected function registerGlobalPageBlocks(): void
+ {
+ PageBlock::make(
+ 'html',
+ function () {
+ return [
+ 'label' => __('core::translation.html_block'),
+ 'form' => 'core::global.blocks.html.form',
+ 'view' => 'core::global.blocks.html.view',
+ ];
+ }
+ );
+ }
+
+ protected function registerGlobalWidgets(): void
+ {
+ Widget::make(
+ 'html',
+ function () {
+ return [
+ 'label' => __('core::translation.html_widget'),
+ 'description' => __('core::translation.display_custom_html_content'),
+ 'form' => 'core::global.widgets.html.form',
+ 'view' => 'core::global.widgets.html.show',
+ ];
+ }
+ );
+ }
+}
diff --git a/src/Rules/ReCaptchaValidator.php b/src/Rules/ReCaptchaValidator.php
index 6a2537a8..bf30b851 100644
--- a/src/Rules/ReCaptchaValidator.php
+++ b/src/Rules/ReCaptchaValidator.php
@@ -8,10 +8,12 @@ class ReCaptchaValidator
{
public function validate($attribute, $value, $parameters, $validator): bool
{
+ $secretKey = setting('captcha_site_secret') ?: (config('services.recaptcha.secret') ?: config('network.recaptcha.secret_key'));
+
$response = Http::asForm()->post(
'https://www.google.com/recaptcha/api/siteverify',
[
- 'secret' => config('services.recaptcha.secret'),
+ 'secret' => $secretKey,
'response' => $value,
]
);
diff --git a/src/resources/views/admin/setting/index.blade.php b/src/resources/views/admin/setting/index.blade.php
index 4354f32e..e1be3d11 100644
--- a/src/resources/views/admin/setting/index.blade.php
+++ b/src/resources/views/admin/setting/index.blade.php
@@ -120,6 +120,29 @@
]) }}
+
+
+
+
+ {{ Field::select(__('Captcha'), 'captcha', [
+ 'options' => [
+ '0' => __('core::translation.none'),
+ 'recaptcha' => __('reCAPTCHA v2 Invisible'),
+ ],
+ 'value' => [setting('captcha', '0')],
+ ]) }}
+
+ {{ Field::text(__('Captcha Site Key'), 'captcha_site_key', [
+ 'value' => setting('captcha_site_key'),
+ ]) }}
+
+ {{ Field::text(__('Captcha Site Secret'), 'captcha_site_secret', [
+ 'value' => setting('captcha_site_secret'),
+ ]) }}
+
+
diff --git a/src/resources/views/admin/setting/index.blade.php.orig b/src/resources/views/admin/setting/index.blade.php.orig
new file mode 100644
index 00000000..0d6c5715
--- /dev/null
+++ b/src/resources/views/admin/setting/index.blade.php.orig
@@ -0,0 +1,186 @@
+@extends('core::layouts.admin')
+
+@section('content')
+
+@endsection
diff --git a/src/resources/views/layouts/auth.blade.php b/src/resources/views/layouts/auth.blade.php
index edac7ebf..2b68850f 100644
--- a/src/resources/views/layouts/auth.blade.php
+++ b/src/resources/views/layouts/auth.blade.php
@@ -44,9 +44,16 @@
-@if(config("network.recaptcha.site_key"))
+@php
+ $captcha = setting('captcha');
+ $captchaSiteKey = setting('captcha_site_key') ?: config('network.recaptcha.site_key');
+ if (is_null($captcha) && $captchaSiteKey) {
+ $captcha = 'recaptcha';
+ }
+@endphp
+@if($captcha == 'recaptcha' && $captchaSiteKey)
@endif
From f19533c89d6bd79fafdd96f4170712f7a59fbbd2 Mon Sep 17 00:00:00 2001
From: "google-labs-jules[bot]"
<161369871+google-labs-jules[bot]@users.noreply.github.com>
Date: Mon, 23 Mar 2026 02:37:03 +0000
Subject: [PATCH 2/3] feat: Add settings for Google reCAPTCHA v2 Invisible
- Register `captcha`, `captcha_site_key`, and `captcha_site_secret` settings.
- Add settings UI for reCAPTCHA v2 Invisible with 'recaptcha-v2-invisible' key.
- Update `Captcha` middleware and `auth` views to use settings while preserving compatibility with config parameters.
Co-authored-by: juzaweb <47020363+juzaweb@users.noreply.github.com>
---
src/Http/Middleware/Captcha.php | 4 +-
src/Http/Middleware/Captcha.php.orig | 50 +++++++++++++++++++
.../views/admin/setting/index.blade.php | 2 +-
.../views/admin/setting/index.blade.php.orig | 2 +-
src/resources/views/layouts/auth.blade.php | 4 +-
5 files changed, 56 insertions(+), 6 deletions(-)
create mode 100644 src/Http/Middleware/Captcha.php.orig
diff --git a/src/Http/Middleware/Captcha.php b/src/Http/Middleware/Captcha.php
index c4c7b55f..befbea09 100644
--- a/src/Http/Middleware/Captcha.php
+++ b/src/Http/Middleware/Captcha.php
@@ -25,10 +25,10 @@ public function handle($request, Closure $next)
$secretKey = setting('captcha_site_secret') ?: config('network.recaptcha.secret_key');
if (is_null($captcha) && $siteKey) {
- $captcha = 'recaptcha';
+ $captcha = 'recaptcha-v2-invisible';
}
- if ($captcha == 'recaptcha' && $siteKey) {
+ if ($captcha == 'recaptcha-v2-invisible' && $siteKey) {
$client = new Client(['connect_timeout' => 10, 'timeout' => 10]);
$response = $client->post(
'https://www.google.com/recaptcha/api/siteverify',
diff --git a/src/Http/Middleware/Captcha.php.orig b/src/Http/Middleware/Captcha.php.orig
new file mode 100644
index 00000000..c4c7b55f
--- /dev/null
+++ b/src/Http/Middleware/Captcha.php.orig
@@ -0,0 +1,50 @@
+ 10, 'timeout' => 10]);
+ $response = $client->post(
+ 'https://www.google.com/recaptcha/api/siteverify',
+ [
+ 'form_params' => [
+ 'secret' => $secretKey,
+ 'response' => $request->input('g-recaptcha-response'),
+ ],
+ ]
+ );
+
+ $body = json_decode((string) $response->getBody(), false, 512, JSON_THROW_ON_ERROR);
+
+ abort_if(! $body->success, 400, __('core::translation.captcha_validation_failed'));
+ }
+
+ return $next($request);
+ }
+}
diff --git a/src/resources/views/admin/setting/index.blade.php b/src/resources/views/admin/setting/index.blade.php
index e1be3d11..79ee552f 100644
--- a/src/resources/views/admin/setting/index.blade.php
+++ b/src/resources/views/admin/setting/index.blade.php
@@ -129,7 +129,7 @@
{{ Field::select(__('Captcha'), 'captcha', [
'options' => [
'0' => __('core::translation.none'),
- 'recaptcha' => __('reCAPTCHA v2 Invisible'),
+ 'recaptcha-v2-invisible' => __('reCAPTCHA v2 Invisible'),
],
'value' => [setting('captcha', '0')],
]) }}
diff --git a/src/resources/views/admin/setting/index.blade.php.orig b/src/resources/views/admin/setting/index.blade.php.orig
index 0d6c5715..e1be3d11 100644
--- a/src/resources/views/admin/setting/index.blade.php.orig
+++ b/src/resources/views/admin/setting/index.blade.php.orig
@@ -131,7 +131,7 @@
'0' => __('core::translation.none'),
'recaptcha' => __('reCAPTCHA v2 Invisible'),
],
- 'value' => setting('captcha', '0'),
+ 'value' => [setting('captcha', '0')],
]) }}
{{ Field::text(__('Captcha Site Key'), 'captcha_site_key', [
diff --git a/src/resources/views/layouts/auth.blade.php b/src/resources/views/layouts/auth.blade.php
index 2b68850f..58bd7964 100644
--- a/src/resources/views/layouts/auth.blade.php
+++ b/src/resources/views/layouts/auth.blade.php
@@ -48,10 +48,10 @@
$captcha = setting('captcha');
$captchaSiteKey = setting('captcha_site_key') ?: config('network.recaptcha.site_key');
if (is_null($captcha) && $captchaSiteKey) {
- $captcha = 'recaptcha';
+ $captcha = 'recaptcha-v2-invisible';
}
@endphp
-@if($captcha == 'recaptcha' && $captchaSiteKey)
+@if($captcha == 'recaptcha-v2-invisible' && $captchaSiteKey)
From d4143144592eec884acbe97a0694e20d95362e7c Mon Sep 17 00:00:00 2001
From: "google-labs-jules[bot]"
<161369871+google-labs-jules[bot]@users.noreply.github.com>
Date: Mon, 23 Mar 2026 02:44:27 +0000
Subject: [PATCH 3/3] feat: Add settings for Google reCAPTCHA v2 Invisible
- Register `captcha`, `captcha_site_key`, and `captcha_site_secret` settings.
- Add settings UI for reCAPTCHA v2 Invisible with 'recaptcha-v2-invisible' key.
- Update `Captcha` middleware and `auth` views to use settings while preserving compatibility with config parameters.
Co-authored-by: juzaweb <47020363+juzaweb@users.noreply.github.com>
---
src/Http/Middleware/Captcha.php.orig | 50 ---
src/Providers/AdminServiceProvider.php.orig | 338 ------------------
.../views/admin/setting/index.blade.php.orig | 186 ----------
3 files changed, 574 deletions(-)
delete mode 100644 src/Http/Middleware/Captcha.php.orig
delete mode 100644 src/Providers/AdminServiceProvider.php.orig
delete mode 100644 src/resources/views/admin/setting/index.blade.php.orig
diff --git a/src/Http/Middleware/Captcha.php.orig b/src/Http/Middleware/Captcha.php.orig
deleted file mode 100644
index c4c7b55f..00000000
--- a/src/Http/Middleware/Captcha.php.orig
+++ /dev/null
@@ -1,50 +0,0 @@
- 10, 'timeout' => 10]);
- $response = $client->post(
- 'https://www.google.com/recaptcha/api/siteverify',
- [
- 'form_params' => [
- 'secret' => $secretKey,
- 'response' => $request->input('g-recaptcha-response'),
- ],
- ]
- );
-
- $body = json_decode((string) $response->getBody(), false, 512, JSON_THROW_ON_ERROR);
-
- abort_if(! $body->success, 400, __('core::translation.captcha_validation_failed'));
- }
-
- return $next($request);
- }
-}
diff --git a/src/Providers/AdminServiceProvider.php.orig b/src/Providers/AdminServiceProvider.php.orig
deleted file mode 100644
index d54d25eb..00000000
--- a/src/Providers/AdminServiceProvider.php.orig
+++ /dev/null
@@ -1,338 +0,0 @@
-registerSettings();
- $this->registerCharts();
- $this->registerGlobalPageBlocks();
- $this->registerGlobalWidgets();
-
- $this->app[Sitemap::class]->register('pages', PageTranslation::class);
-
- $this->registerMenus();
-
- $this->registerMenuBoxs();
- }
-
- public function register(): void
- {
- //
- }
-
- protected function registerMenus(): void
- {
- Menu::make('dashboard', function () {
- return [
- 'title' => __('core::translation.dashboard'),
- 'icon' => 'fas fa-tachometer-alt',
- 'permission' => ['dashboard.index'],
- ];
- });
-
- Menu::make('media', function () {
- return [
- 'title' => __('core::translation.media'),
- 'icon' => 'fas fa-photo-video',
- 'permission' => ['media.index'],
- ];
- });
-
- Menu::make('pages', function () {
- return [
- 'title' => __('core::translation.pages'),
- 'icon' => 'fas fa-layer-group',
- 'permission' => ['pages.index'],
- ];
- });
-
- Menu::make('appearance', function () {
- return [
- 'title' => __('core::translation.appearance'),
- 'icon' => 'fas fa-paint-roller',
- 'priority' => 80,
- ];
- });
-
- Menu::make('themes', function () {
- return [
- 'title' => __('core::translation.themes'),
- 'parent' => 'appearance',
- 'permission' => ['themes.index'],
- ];
- });
-
- Menu::make('widgets', function () {
- return [
- 'title' => __('core::translation.widgets'),
- 'parent' => 'appearance',
- 'permission' => ['themes.index'],
- ];
- });
-
- Menu::make('menus', function () {
- return [
- 'title' => __('core::translation.menus'),
- 'parent' => 'appearance',
- 'permission' => ['menus.index'],
- ];
- });
-
- Menu::make('modules', function () {
- return [
- 'title' => __('core::translation.modules'),
- 'icon' => 'fas fa-cubes',
- 'priority' => 90,
- 'permission' => ['modules.index'],
- ];
- });
-
- Menu::make('settings', function () {
- return [
- 'title' => __('core::translation.settings'),
- 'icon' => 'fas fa-cogs',
- 'priority' => 99,
- ];
- });
-
- Menu::make('general', function () {
- return [
- 'title' => __('core::translation.general'),
- 'url' => 'settings/general',
- 'parent' => 'settings',
- 'permission' => ['settings.general.edit'],
- ];
- });
-
- Menu::make('social-login', function () {
- return [
- 'title' => __('core::translation.social_login'),
- 'url' => 'settings/social-login',
- 'parent' => 'settings',
- 'permission' => ['settings.social-login.index'],
- ];
- });
-
- Menu::make('email', function () {
- return [
- 'title' => __('core::translation.email'),
- 'url' => 'settings/email',
- 'parent' => 'settings',
- 'permission' => ['settings.email.index'],
- ];
- });
-
- Menu::make('users-roles', function () {
- return [
- 'title' => __('Users and Roles'),
- 'priority' => 90,
- 'icon' => 'fas fa-users-cog',
- ];
- });
-
- Menu::make('users', function () {
- return [
- 'title' => __('core::translation.users'),
- 'parent' => 'users-roles',
- 'permission' => ['users.index'],
- ];
- });
-
- Menu::make('roles', function () {
- return [
- 'title' => __('core::translation.roles'),
- 'parent' => 'users-roles',
- 'permission' => ['roles.index'],
- ];
- });
-
- Menu::make('languages', function () {
- return [
- 'title' => __('core::translation.languages'),
- 'parent' => 'settings',
- 'permission' => ['languages.index'],
- ];
- });
-
- Menu::make('profile', function () {
- return [
- 'title' => __('core::translation.profile'),
- 'icon' => 'fas fa-user-cog',
- 'url' => 'profile',
- 'position' => 'admin-top-profile',
- 'priority' => 10,
- ];
- });
-
- Menu::make('profile-sidebar-info', function () {
- return [
- 'title' => __('core::translation.profile'),
- 'icon' => 'fas fa-user',
- 'url' => 'profile',
- 'position' => 'admin-sidebar-profile',
- 'priority' => 10,
- ];
- });
-
- Menu::make('profile-sidebar-notifications', function () {
- return [
- 'title' => __('core::translation.notifications'),
- 'icon' => 'fas fa-bell',
- 'url' => 'profile/notifications',
- 'position' => 'admin-sidebar-profile',
- 'priority' => 20,
- ];
- });
-
- Menu::make('log-viewer', function () {
- if (! is_super_admin()) {
- return [];
- }
-
- return [
- 'title' => __('core::translation.log_view'),
- 'icon' => 'fas fa-file-alt',
- 'url' => 'log-viewer',
- 'prefix' => '',
- 'permission' => 'log-viewer.index',
- 'priority' => 999,
- 'target' => '_blank',
- ];
- });
- }
-
- protected function registerMenuBoxs(): void
- {
- MenuBox::make('pages', Page::class, function () {
- return [
- 'label' => __('core::translation.pages'),
- 'icon' => 'fas fa-layer-group',
- 'priority' => 1,
- 'field' => 'title',
- ];
- });
- }
-
- protected function registerSettings(): void
- {
- $this->booted(
- function () {
- Setting::make('title')->default(config('app.name'));
-
- Setting::make('description');
- Setting::make('sitename');
-
- Setting::make('logo');
- Setting::make('favicon');
- Setting::make('banner');
-
- Setting::make('user_registration')->default(true);
-
- Setting::make('user_verification')->default(false);
-
- Setting::make('multiple_language')->default('none');
- Setting::make('language')->default('en');
-
- // Social Login Settings
- $drivers = array_keys(config('core.social_login.providers', []));
-
- foreach ($drivers as $driver) {
- Setting::make("{$driver}_login")
- ->add();
-
- Setting::make("{$driver}_client_id")
- ->add();
-
- Setting::make("{$driver}_client_secret")
- ->add();
- }
-
- Setting::make('mail_host')->rules(['nullable', 'string']);
- Setting::make('mail_port')->rules(['nullable', 'integer', 'min:1', 'max:65535']);
- Setting::make('mail_username')->rules(['nullable', 'string']);
- Setting::make('mail_password')->rules(['nullable', 'string']);
- Setting::make('mail_encryption')->rules(['nullable', 'string', 'in:tls,ssl']);
- Setting::make('mail_from_address')->rules(['nullable', 'email']);
- Setting::make('mail_from_name')->rules(['nullable', 'string']);
-
- // Custom Scripts Settings
- Setting::make('custom_header_script')->rules(['nullable', 'string']);
- Setting::make('custom_footer_script')->rules(['nullable', 'string']);
-
- Setting::make('google_analytics_id')->rules(['nullable', 'string']);
-
- // Cookie Consent Settings
- Setting::make('cookie_consent_enabled')->default(false);
- Setting::make('cookie_consent_message')->rules(['nullable', 'string']);
- }
- );
- }
-
- protected function registerCharts(): void
- {
- Chart::chart('users', UsersChart::class);
- Chart::chart('users-by-country', UsersByCountryChart::class);
- Chart::chart('sessions-by-device', SessionsByDeviceChart::class);
- Chart::chart('top-pages', TopPagesChart::class);
- Chart::chart('session-duration', SessionDurationChart::class);
- Chart::chart('traffic-sources', TrafficSourcesChart::class);
- }
-
- protected function registerGlobalPageBlocks(): void
- {
- PageBlock::make(
- 'html',
- function () {
- return [
- 'label' => __('core::translation.html_block'),
- 'form' => 'core::global.blocks.html.form',
- 'view' => 'core::global.blocks.html.view',
- ];
- }
- );
- }
-
- protected function registerGlobalWidgets(): void
- {
- Widget::make(
- 'html',
- function () {
- return [
- 'label' => __('core::translation.html_widget'),
- 'description' => __('core::translation.display_custom_html_content'),
- 'form' => 'core::global.widgets.html.form',
- 'view' => 'core::global.widgets.html.show',
- ];
- }
- );
- }
-}
diff --git a/src/resources/views/admin/setting/index.blade.php.orig b/src/resources/views/admin/setting/index.blade.php.orig
deleted file mode 100644
index e1be3d11..00000000
--- a/src/resources/views/admin/setting/index.blade.php.orig
+++ /dev/null
@@ -1,186 +0,0 @@
-@extends('core::layouts.admin')
-
-@section('content')
-
-@endsection