自动读取主题
This commit is contained in:
parent
c17e1fb651
commit
6eeeea11cc
|
|
@ -16,6 +16,7 @@ use Beike\Repositories\CountryRepo;
|
|||
use Beike\Repositories\CurrencyRepo;
|
||||
use Beike\Repositories\CustomerGroupRepo;
|
||||
use Beike\Repositories\SettingRepo;
|
||||
use Beike\Repositories\ThemeRepo;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class SettingController extends Controller
|
||||
|
|
@ -27,10 +28,7 @@ class SettingController extends Controller
|
|||
*/
|
||||
public function index()
|
||||
{
|
||||
$themes = [
|
||||
['value' => 'default', 'label' => trans('admin/setting.theme_default')],
|
||||
['value' => 'black', 'label' => trans('admin/setting.theme_black')],
|
||||
];
|
||||
$themes = ThemeRepo::getAllThemes();
|
||||
|
||||
$tax_address = [
|
||||
['value' => 'shipping', 'label' => trans('admin/setting.shipping_address')],
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
/**
|
||||
* ThemeRepo.php
|
||||
*
|
||||
* @copyright 2023 beikeshop.com - All Rights Reserved
|
||||
* @link https://beikeshop.com
|
||||
* @author Edward Yang <yangjin@guangda.work>
|
||||
* @created 2023-02-06 17:06:11
|
||||
* @modified 2023-02-06 17:06:11
|
||||
*/
|
||||
|
||||
namespace Beike\Repositories;
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class ThemeRepo
|
||||
{
|
||||
public static function getAllThemes()
|
||||
{
|
||||
$path = base_path('themes');
|
||||
$themePaths = glob($path . '/*');
|
||||
$themes = [];
|
||||
foreach ($themePaths as $themePath) {
|
||||
$theme = trim(str_replace($path, '', $themePath), '/');
|
||||
$themes[] = [
|
||||
'value' => $theme,
|
||||
'label' => Str::studly($theme),
|
||||
];
|
||||
}
|
||||
|
||||
return $themes;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue