opnform/app/Providers/AppServiceProvider.php

57 lines
1.5 KiB
PHP
Raw Permalink Normal View History

2022-09-20 19:59:52 +00:00
<?php
namespace App\Providers;
2023-12-03 14:02:48 +00:00
use App\Models\Billing\Subscription;
2022-09-20 19:59:52 +00:00
use Illuminate\Http\Resources\Json\JsonResource;
use Illuminate\Support\Facades\Schema;
2024-02-23 10:54:12 +00:00
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\URL;
use Illuminate\Support\Facades\Validator;
2022-09-20 19:59:52 +00:00
use Illuminate\Support\ServiceProvider;
use Laravel\Cashier\Cashier;
use Laravel\Dusk\DuskServiceProvider;
2024-02-23 10:54:12 +00:00
2022-09-20 19:59:52 +00:00
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
2024-02-23 10:54:12 +00:00
if (config('filesystems.default') === 'local') {
Storage::disk('local')->buildTemporaryUrlsUsing(function ($path, $expiration, $options) {
return URL::temporarySignedRoute(
'local.temp',
$expiration,
array_merge($options, ['path' => $path])
);
});
}
2022-09-20 19:59:52 +00:00
JsonResource::withoutWrapping();
Cashier::calculateTaxes();
2023-12-03 14:02:48 +00:00
Cashier::useSubscriptionModel(Subscription::class);
2022-09-20 19:59:52 +00:00
if ($this->app->runningUnitTests()) {
Schema::defaultStringLength(191);
}
Validator::includeUnvalidatedArrayKeys();
}
/**
* Register any application services.
*
* @return void
*/
public function register()
{
if ($this->app->environment('local', 'testing') && class_exists(DuskServiceProvider::class)) {
$this->app->register(DuskServiceProvider::class);
}
}
}