diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 1e63fa5..2d51fab 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -6,6 +6,8 @@ use App\Models\HostingAccount; use App\Policies\HostingAccountPolicy; use Illuminate\Support\Facades\Gate; use Illuminate\Support\ServiceProvider; +use App\Support\MobileTopbar; +use Illuminate\Support\Facades\View; class AppServiceProvider extends ServiceProvider { @@ -17,5 +19,9 @@ class AppServiceProvider extends ServiceProvider public function boot(): void { Gate::policy(HostingAccount::class, HostingAccountPolicy::class); + View::composer(['partials.topbar'], function ($view) { + $view->with(MobileTopbar::resolve()); + }); + } } diff --git a/app/Support/MobileTopbar.php b/app/Support/MobileTopbar.php new file mode 100644 index 0000000..5115afc --- /dev/null +++ b/app/Support/MobileTopbar.php @@ -0,0 +1,25 @@ + $patternTitle) { + if (request()->routeIs($pattern)) { + $title = is_callable($patternTitle) ? $patternTitle() : $patternTitle; + break; + } + } + + return [ + 'mobileTopbarSubtitle' => $subtitle, + 'mobileTopbarTitle' => $title, + ]; + } +} diff --git a/config/mobile-topbar.php b/config/mobile-topbar.php new file mode 100644 index 0000000..a8d7501 --- /dev/null +++ b/config/mobile-topbar.php @@ -0,0 +1,22 @@ + 'Hosting', + 'default_title' => 'Dashboard', + 'patterns' => [ + 'hosting.dashboard' => 'Dashboard', + 'hosting.index' => 'Dashboard', + 'hosting.search' => 'Search', + 'hosting.single-domain' => 'Single Domain', + 'hosting.multi-domain' => 'Multi Domain', + 'hosting.wordpress' => 'WordPress', + 'hosting.accounts.*' => 'Accounts', + 'hosting.orders.*' => 'Orders', + 'hosting.panel.*' => 'Control panel', + 'account.wallet' => 'Wallet', + 'account.billing' => 'Billing', + 'account.team*' => 'Team', + 'account.settings' => 'Settings', + 'notifications.*' => 'Notifications', + ], +]; diff --git a/resources/views/components/mobile-page-header.blade.php b/resources/views/components/mobile-page-header.blade.php index acd3927..dc4aa60 100644 --- a/resources/views/components/mobile-page-header.blade.php +++ b/resources/views/components/mobile-page-header.blade.php @@ -3,6 +3,7 @@ 'subtitle' => null, 'backUrl' => null, 'badge' => null, + 'hideAfia' => false, ])
{{ $subtitle }}
+ @endif +