芝麻web文件管理V1.00
编辑当前文件:/home/lekhnath/silverray.com.au/app/Providers/AppServiceProvider.php
key] = $setting_item->value; } $setting = (object) $setting; return $setting; }); $backgroundImage = Cache::rememberForever('backgroundImage', function () { $backgroundImage = BackgroundImage::first(); return $backgroundImage; }); $contactInformation = Cache::rememberForever('contactInformation', function () { $contactInformation = ContactInformation::with('translation')->first(); return $contactInformation; }); $frontSocialLinks = Cache::rememberForever('frontSocialLinks', function () { $frontSocialLinks = SocialLink::where('status', 1)->get(); return $frontSocialLinks; }); // Setup mail configuration $mailConfig = [ 'transport' => 'smtp', 'host' => $setting?->mail_host, 'port' => $setting?->mail_port, 'encryption' => $setting?->mail_encryption, 'username' => $setting?->mail_username, 'password' => $setting?->mail_password, 'timeout' => null, ]; config(['mail.mailers.smtp' => $mailConfig]); config(['mail.from.address' => $setting?->mail_sender_email]); config(['mail.from.name' => $setting?->mail_sender_name]); // setup timezone globally config(['app.timezone' => $setting?->timezone]); config(['broadcasting.connections.pusher.key' => $setting?->pusher_app_key]); config(['broadcasting.connections.pusher.secret' => $setting?->pusher_app_secret]); config(['broadcasting.connections.pusher.app_id' => $setting?->pusher_app_id]); config(['broadcasting.connections.pusher.options.cluster' => $setting?->pusher_app_cluster]); config(['broadcasting.connections.pusher.options.host' => 'api-'.$setting?->pusher_app_cluster.'.pusher.com']); Cache::rememberForever('CustomPagination', function () { $custom_pagination = CustomPagination::all(); $pagination = []; foreach ($custom_pagination as $item) { $pagination[str_replace(' ', '_', strtolower($item?->section_name))] = $item?->item_qty; } $pagination = (object) $pagination; return $pagination; }); } catch (Exception $ex) { $setting = null; Log::error($ex->getMessage()); } View::composer('*', function ($view) { $setting = Cache::get('setting'); $backgroundImage = Cache::get('backgroundImage'); $contactInformation = Cache::get('contactInformation'); $frontSocialLinks = Cache::get('frontSocialLinks'); $view->with([ 'setting' => $setting, 'backgroundImage' => $backgroundImage, 'contactInformation' => $contactInformation, 'frontSocialLinks' => $frontSocialLinks ]); }); /** * Register custom blade directives * this can be used for permission or permissions check * this check will be perform on admin guard */ $this->registerBladeDirectives(); Paginator::useBootstrapFour(); } protected function registerBladeDirectives() { Blade::directive('adminCan', function ($permission) { return "guard('admin')->user()->can({$permission})): ?>"; }); Blade::directive('endadminCan', function () { return ''; }); } }