- Menambahkan pemanggilan Model::automaticallyEagerLoadRelationships() di metode boot. - Meningkatkan performa dengan mengoptimalkan pemuatan relasi model secara otomatis.
26 lines
444 B
PHP
26 lines
444 B
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
class AppServiceProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* Register any application services.
|
|
*/
|
|
public function register(): void
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Bootstrap any application services.
|
|
*/
|
|
public function boot(): void
|
|
{
|
|
Model::automaticallyEagerLoadRelationships();
|
|
}
|
|
}
|