MGHollander / cooking-with-laravel

Web application to collect recipes from anywhere on one website.
https://koken.maruc.nl
1 stars 0 forks source link

Check for N+1 problems #33

Open MGHollander opened 1 year ago

MGHollander commented 1 year ago

Check for N+1 problems on the index and other overview pages.

Add

namespace App\Providers;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{
    public function boot(): void
    {
        Model::preventLazyLoading();
        Model::preventAccessingMissingAttributes();
        Model::preventSilentlyDiscardingAttributes();
    }
}