Skip to content

Commit

Permalink
feat: make theme customization not available to nano
Browse files Browse the repository at this point in the history
This is for implementing plan model.
  • Loading branch information
itsmenewbie03 committed May 12, 2024
1 parent 548d281 commit 5e5dbfc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
7 changes: 6 additions & 1 deletion app/Http/Controllers/TenantCustomizationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,20 @@

use Illuminate\Contracts\View\Factory;
use Illuminate\Contracts\View\View;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;

class TenantCustomizationController extends Controller
{
/**
* Custom method for theme customization
*/
public function theme(Request $request): View|Factory
public function theme(Request $request): RedirectResponse|View|Factory
{
if(tenant('plan') == 'nano') {
return redirect()->route('dashboard')->with('error_message', 'You need to upgrade your plan to access this feature.');
}

if(is_null($request->input("prefersDarkMode"))) {
return view('tenants.customizations.init');
}
Expand Down
9 changes: 6 additions & 3 deletions resources/views/dashboard.blade.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
<x-app-l <x-app-layout>
<x-app-layout>
<x-slot name="header">
<h2 class="font-semibold text-xl text-gray-800 dark:text-gray-200 leading-tight">
{{ __('Dashboard') }}
</h2>
</x-slot>

<div class="py-12">
@if (session()->has('error_message'))
<x-mary-alert class="alert-error" icon="o-exclamation-triangle" title="{{ session('error_message') }}"
dismissible />
@endif
{{-- NOTE: we will only check for updates if were on the dashboard route of the central app --}}
@if (is_null(tenant('id')))
@if (Route::current()->getName() === 'dashboard')
Expand Down Expand Up @@ -74,5 +78,4 @@ class="text-orange-500" color="text-pink-500" tooltip-right="Gosh!" />
@yield('content')
@endif
</div>
</x-app-layout>
ayout>
</x-app-layout>

0 comments on commit 5e5dbfc

Please sign in to comment.