⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.19
Server IP:
178.33.27.10
Server:
Linux cpanel.dev-unit.com 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64
Server Software:
Apache/2.4.57 (Unix) OpenSSL/1.0.2k-fips
PHP Version:
8.2.11
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
home
/
id
/
b2c-booking.dev-unit.com
/
themes
/
View File Name :
ThemeServiceProvider.php
<?php namespace Themes; use Illuminate\Http\Request; use Illuminate\Support\Facades\File; use Illuminate\Support\Facades\View; use Illuminate\Support\ServiceProvider; use Modules\Theme\ThemeManager; use Themes\Base\ThemeProvider; class ThemeServiceProvider extends ServiceProvider { public function boot(Request $request){ if(!is_installed() || strpos($request->path(), 'install') !== false) return false; // load Theme overwrite $active = ThemeManager::current(); $provider = ThemeManager::currentProvider(); $parent = $provider::$parent; if(strtolower($active) != "base"){ $view_paths = config('view.paths'); array_unshift($view_paths,__DIR__.'/Base/resources/views'); if($parent){ array_unshift($view_paths,__DIR__.'/'.ucfirst($parent).'/resources/views'); } array_unshift($view_paths,__DIR__.'/'.ucfirst($active).'/resources/views'); config()->set('view.paths',$view_paths); View::addLocation(base_path("themes".DIRECTORY_SEPARATOR.ucfirst($active))); if($parent){ View::addLocation(base_path("themes".DIRECTORY_SEPARATOR.ucfirst($parent))); } // Load modules views $this->loadModuleViews($active); if($parent){ $this->loadModuleViews($parent); } } // Base Theme require View::addLocation(base_path(DIRECTORY_SEPARATOR."themes".DIRECTORY_SEPARATOR."Base")); // Load modules views $this->loadModuleViews('base'); } protected function loadModuleViews($theme){ $listModule = array_map('basename', File::directories(base_path('themes/'.ucfirst($theme)))); foreach ($listModule as $module) { if (is_dir(base_path('themes/'.ucfirst($theme) .'/'. $module))) { $this->loadViewsFrom(base_path('themes/'.ucfirst($theme) .'/'. $module).'/Views', $module); } } if (is_dir(base_path('themes/'.ucfirst($theme).'/Layout'))) { $this->loadViewsFrom(base_path('themes/'.ucfirst($theme).'/Layout'), 'Layout'); } } public function register() { //load Theme overwrite $class = \Modules\Theme\ThemeManager::currentProvider(); if(class_exists($class)){ $this->app->register($class); } } }