51 lines
1.6 KiB
PHP
51 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use App\View\Composers\MonthGraph;
|
|
use App\View\Composers\OptionLogo;
|
|
use App\View\Composers\TaxDropdown;
|
|
use App\View\Composers\YearGraph;
|
|
use Illuminate\Support\Facades\URL;
|
|
use Illuminate\Support\Facades\View;
|
|
use Illuminate\Support\Number;
|
|
use Illuminate\Support\ServiceProvider;
|
|
use Illuminate\Translation\Translator;
|
|
|
|
class AppServiceProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* Register any application services.
|
|
*/
|
|
public function register(): void
|
|
{
|
|
if ($this->app->environment() === 'local') {
|
|
$this->app->register(\Laravel\Telescope\TelescopeServiceProvider::class);
|
|
$this->app->register(TelescopeServiceProvider::class);
|
|
|
|
$this->app->extend('translator', function (Translator $translator) {
|
|
$trans = new \App\Translator($translator->getLoader(), $translator->getLocale());
|
|
$trans->setFallback($translator->getFallback());
|
|
return $trans;
|
|
});
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Bootstrap any application services.
|
|
*/
|
|
public function boot(): void
|
|
{
|
|
View::composer('components.tax-dropdown', TaxDropdown::class);
|
|
View::composer('components.company-logo', OptionLogo::class);
|
|
View::composer('components.graph-year', YearGraph::class);
|
|
View::composer('components.graph-month', MonthGraph::class);
|
|
Number::useLocale(config('app.locale'));
|
|
Number::useCurrency(config('app.currency'));
|
|
|
|
if ($this->app->environment('production') || $this->app->environment('testing')) {
|
|
URL::forceScheme('https');
|
|
}
|
|
}
|
|
}
|