Files
Website/app/Providers/AppServiceProvider.php
2025-11-16 21:41:14 +10:00

36 lines
910 B
PHP

<?php
namespace App\Providers;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\Facades\URL;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*/
public function register(): void
{
//
}
/**
* Bootstrap any application services.
*/
public function boot(): void
{
if ($this->app->environment('production')) {
URL::forceScheme('https');
}
Blade::directive('includeSVG', function ($arguments) {
list($path, $styles) = array_pad(explode(',', str_replace(['(', ')', ' ', "'"], '', $arguments), 2), 2, '');
$svgContent = file_get_contents(public_path($path));
$svgContent = str_replace('<svg ', '<svg style="'.$styles.'" ', $svgContent);
return $svgContent;
});
}
}