Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here

pterodactyl/panel

8314 stars
3 code files
View pterodactyl/panel on GitHub

app/Providers/ViewComposerServiceProvider.php

Open in GitHub
use Illuminate\Support\ServiceProvider;
use Pterodactyl\Http\ViewComposers\AssetComposer;
 
class ViewComposerServiceProvider extends ServiceProvider
{
public function boot()
{
$this->app->make('view')->composer('*', AssetComposer::class);
}
}

app/Http/ViewComposers/AssetComposer.php

Open in GitHub
use Illuminate\View\View;
use Pterodactyl\Services\Helpers\AssetHashService;
 
class AssetComposer
{
/**
* @var \Pterodactyl\Services\Helpers\AssetHashService
*/
private $assetHashService;
 
/**
* AssetComposer constructor.
*
* @param \Pterodactyl\Services\Helpers\AssetHashService $assetHashService
*/
public function __construct(AssetHashService $assetHashService)
{
$this->assetHashService = $assetHashService;
}
 
/**
* Provide access to the asset service in the views.
*
* @param \Illuminate\View\View $view
*/
public function compose(View $view)
{
$view->with('asset', $this->assetHashService);
$view->with('siteConfiguration', [
'name' => config('app.name') ?? 'Pterodactyl',
'locale' => config('app.locale') ?? 'en',
'recaptcha' => [
'enabled' => config('recaptcha.enabled', false),
'siteKey' => config('recaptcha.website_key') ?? '',
],
'analytics' => config('app.analytics') ?? '',
]);
}
}

resources/views/templates/wrapper.blade.php

Open in GitHub
// ...
 
@if(!empty($siteConfiguration))
<script>
window.SiteConfiguration = {!! json_encode($siteConfiguration) !!};
</script>
@endif
 
// ...

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.