1. Home
  2. Laravel
  3. Enable strict mode

Add the following code to AppService provider within the boot() method. It will help with catching common errors in your production environment.

#laravel#log#debug
// public function boot()

// {

    Model::shouldBeStrict( !$this->app->isProduction() )
    
    // shouldBeStrict runs the following methods in the background

    // Model::preventLazyLoading( !$this->app->isProduction() );

    // Model::preventSilentlyDiscardingAttributes( !$this->app->isProduction() );

    // Model::preventAccessingMissingAttributes( !$this->app->isProduction() );

// }
copy
Full Laravel cheatsheet