| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- <?php
- namespace App\Providers;
- use Carbon\CarbonImmutable;
- //use Illuminate\Support\Facades\Data;
- use Illuminate\Database\Eloquent\Model;
- use Illuminate\Database\Eloquent\Relations\Relation;
- use Illuminate\Http\Resources\Json\JsonResource;
- use Illuminate\Support\Facades\Http;
- use Illuminate\Support\ServiceProvider;
- class AppServiceProvider extends ServiceProvider
- {
- /**
- * Register any application services.
- */
- public function register(): void
- {
- if ($this->app->environment('local') && class_exists(\Laravel\Telescope\TelescopeServiceProvider::class)) {
- $this->app->register(\Laravel\Telescope\TelescopeServiceProvider::class);
- $this->app->register(TelescopeServiceProvider::class);
- }
- }
- /**
- * Bootstrap any application services.
- */
- public function boot(): void
- {
- // Data::use(CarbonImmutable::class);
- // As there are concerned with application correctness
- // leave them enable all the time.
- Model::preventAccessingMissingAttributes();
- Model::preventSilentlyDiscardingAttributes();
- // Since this is a performance concern only, don't halt
- // production for violations.
- Model::preventLazyLoading(!$this->app->isProduction());
- Relation::enforceMorphMap([
- // TODO
- ]);
- JsonResource::withoutWrapping();
- Http::macro('inference', fn() => Http::baseUrl(config('services.inference.host'))->timeout(120));
- }
- }
|