title: Eloquent model observer performance
body: <p>If I have multipile models and I working heavy with events so in my AppServiceProvider I create a observer for my models like: </p>
  
  <pre><code>class AppServiceProvider extends ServiceProvider
  {
      /**
       * Bootstrap any application services.
       *
       * @return void
       */
      public function boot()
      {
          User::observe(UserObserver::class);
          User2::observe(UserObserver2::class);
          User3::observe(UserObserver3::class);
          User4::observe(UserObserver4::class);
          User5::observe(UserObserver5::class);
          User6::observe(UserObserver6::class);
          User7::observe(UserObserver7::class);
          User8::observe(UserObserver8::class);
          User9::observe(UserObserver9::class);
      }
  
      /**
       * Register the service provider.
       *
       * @return void
       */
      public function register()
      {
          //
      }
  }
  </code></pre>
  
  <p>does it create some performance penalty? as If I understand the <a href="https://github.com/laravel/framework/blob/5.4/src/Illuminate/Database/Eloquent/Concerns/HasEvents.php#L33" rel="nofollow noreferrer">observe method</a> correctly for every app access it will loop through all my models observers method and will match them to eloquent events so if I have 30 models observers it can cause a bad performance?</p>
  
  <p>is there some clever way of declaring the observe class only when the model is in use? so instead of declaring the observers in each app access even when not needed each model will know about its observer only when its in use?</p>