Skip to content
Open
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
1 change: 1 addition & 0 deletions app/Http/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class Kernel extends HttpKernel
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
\App\Http\Middleware\HandleTheme::class,
];

/**
Expand Down
27 changes: 27 additions & 0 deletions app/Http/Middleware/HandleTheme.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace App\Http\Middleware;

use Closure;
use Illuminate\Http\Request;
use Qirolab\Theme\Theme;
use Symfony\Component\HttpFoundation\Response;

class HandleTheme
{
/**
* Handle an incoming request.
*
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
*/
public function handle(Request $request, Closure $next): Response
{
$activeTheme = getSetting('active_cms_theme', 'default');

if($activeTheme != Theme::active()) {
Theme::set($activeTheme);
}

return $next($request);
}
}
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"laravel/sanctum": "^3.2",
"laravel/socialite": "^5.11",
"laravel/tinker": "^2.8",
"qirolab/laravel-themer": "^2.2",
"socialiteproviders/discord": "^4.2",
"srmklive/paypal": "~3.0",
"symfony/html-sanitizer": "^6.4"
Expand Down
125 changes: 124 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions config/theme.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

return [
/*
|--------------------------------------------------------------------------
| Default Active Theme
|--------------------------------------------------------------------------
|
| It will assign the default active theme to be used if one is not set during
| runtime.
*/
'active' => 'default',

/*
|--------------------------------------------------------------------------
| Parent Theme
|--------------------------------------------------------------------------
|
| This is a parent theme for the theme specified in the active config
| option. It works like the WordPress style theme hierarchy, if the blade
| file is not found in the currently active theme, then it will look for it
| in the parent theme.
*/
'parent' => null,

/*
|--------------------------------------------------------------------------
| Base Path
|--------------------------------------------------------------------------
|
| The base path where all the themes are located.
*/
'base_path' => base_path('themes')
];
5 changes: 5 additions & 0 deletions database/seeders/CmsSettingsSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,11 @@ public function getDefaultSettings(): array
'staff_notification_image',
'https://i.imgur.com/8IcBBTF.gif',
'The staff notification image to show on the CMS'
],
[
'active_cms_theme',
'default',
'The active theme on the CMS'
]
];
}
Expand Down
13 changes: 8 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,22 @@
"private": true,
"scripts": {
"dev": "vite",
"build": "vite build"
"build": "vite build",
"dev:default": "vite --config themes/default/vite.config.js",
"build:default": "vite build --config themes/default/vite.config.js"
},
"devDependencies": {
"@tailwindcss/forms": "^0.5.3",
"@tailwindcss/forms": "^0.5.2",
"@tailwindcss/typography": "^0.5.9",
"alpine-turbo-drive-adapter": "^2.0.0",
"alpinejs": "^3.12.0",
"autoprefixer": "^10.4.14",
"autoprefixer": "^10.4.7",
"axios": "^1.1.2",
"laravel-vite-plugin": "^0.7.2",
"postcss": "^8.4.23",
"postcss": "^8.4.14",
"postcss-import": "^14.1.0",
"sass": "^1.62.0",
"tailwindcss": "^3.3.1",
"tailwindcss": "^3.1.6",
"turbolinks": "^5.2.0",
"vite": "^4.0.0"
},
Expand Down
Loading