⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.45
Server IP:
185.238.29.86
Server:
Linux server2 6.8.12-6-pve #1 SMP PREEMPT_DYNAMIC PMX 6.8.12-6 (2024-12-19T19:05Z) x86_64
Server Software:
nginx/1.18.0
PHP Version:
8.1.31
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
var
/
www
/
dnc
/
@core
/
app
/
Http
/
Middleware
/
View File Name :
GlobalVariableMiddleware.php
<?php namespace App\Http\Middleware; use App\Blog; use App\Importantlink; use App\Language; use App\Menu; use App\SocialIcons; use App\StaticOption; use App\SupportInfo; use App\UsefulLink; use Closure; class GlobalVariableMiddleware { /** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { view()->composer('*', function ($view) { $lang = !empty(session()->get('lang')) ? session()->get('lang') : Language::where('default',1)->first()->slug; $all_language = Language::where('status', 'publish')->get(); $popup_id = get_static_option('popup_selected_'.$lang.'_id'); $popup_details = \App\PopupBuilder::find($popup_id); $website_url = url('/'); if (preg_match('/(xgenious)/',$website_url)){ $popup_details = \App\PopupBuilder::where('lang',$lang)->inRandomOrder()->first(); } $primary_menu = Menu::where(['status' => 'default' ,'lang' => $lang])->first(); $all_support_item = SupportInfo::all(); $all_usefull_links = UsefulLink::all(); $all_important_links = Importantlink::all(); $all_recent_post = Blog::where('status','publish')->orderBy('id', 'DESC')->take(get_static_option('recent_post_widget_item'))->get(); $home_variant_number = (\Request::is('home/*'))? \Request::route('id') : $home_variant_number = get_static_option('home_page_variant'); $all_social_icons = SocialIcons::all(); //make a function to call all static option by home page $static_option_arr = [ 'product_module_status', 'site_white_logo', 'site_google_analytics', 'og_meta_image_for_site', 'site_main_color_one', 'site_main_color_two', 'site_secondary_color', 'site_heading_color', 'site_paragraph_color', 'heading_font', 'heading_font_family', 'body_font_family', 'body_font_family', 'site_rtl_enabled', 'services_page_slug', 'about_page_slug', 'contact_page_slug', 'blog_page_slug', 'team_page_slug', 'faq_page_slug', 'works_page_slug', 'site_third_party_tracking_code', 'site_favicon', 'home_page_variant', 'item_license_status', 'site_script_unique_key', 'site_meta_'.$lang.'_description', 'site_meta_'.$lang.'_tags', 'site_'.$lang.'_title', 'site_'.$lang.'_tag_line', ]; $static_field_data = StaticOption::whereIn('option_name',$static_option_arr)->get()->mapWithKeys(function ($item) { return [$item->option_name => $item->option_value]; })->toArray(); $view->with('global_static_field_data', $static_field_data); $view->with('popup_details', $popup_details); $view->with('all_language', $all_language); $view->with('user_select_lang_slug', $lang); $view->with('home_variant_number', $home_variant_number); $view->with('primary_menu', $primary_menu->id); $view->with('all_social_icons', $all_social_icons); $view->with('all_support_item',$all_support_item); $view->with('all_usefull_links',$all_usefull_links); $view->with('all_important_links',$all_important_links); $view->with('all_recent_post',$all_recent_post); }); return $next($request); } }