title: Any reason for eloquent behaving differently on local and uat/prod?
body: <p>I have a little challenge here and can't really get my head around what's going on.</p>
  <p>Given</p>
  <p>ServiceA</p>
  <p>ServiceB</p>
  <p>ServiceC</p>
  <p>ServiceA calls ServiceB-&gt;function() and passes in some params from some collections present in ServiceA</p>
  <p>ServiceA then calls ServiceC&gt;functioN() and passes in some collections as params present in ServiceA</p>
  <p>Somehow the code inside ServiceB and ServiceC does NOT run/or do on uat and prod what it does no problem on local.</p>
  <p>I mean actually the ServiceC throws the following error on uat (cautght in uat fpm7.2 logs)</p>
  <p><em>PHP Fatal Error: Uncaught TypeError Return value of path\to\file::function() must be an instance of Model, null returned.</em></p>
  <p>On my local this all goes fine and works correctly.</p>
  <p>additional <em>PHP Notice for some Undefined offsets</em> for some of the Collections I am passing to both ServiceB and ServiceC, but again, causes no problem on local.</p>
  <p>Any tips, any idea?</p>
  <p>ps. I checked the data and it is there on both uat/prod and my local</p>
  <p>thanks</p>
  <p>edit. adding code:</p>
  <pre><code>    protected function getOriginalObjectCompletion(Collection $object, array $courseIds): ObjectCompleted
  {
      return $Object-&gt;where('course', $courseIds['courseFromId'])-&gt;pluck('feedbackCompletions')-&gt;flatten()-&gt;first();
  }
  </code></pre>
  <p>this is the code that throws the 'Fatal error: Uncaught TypeError' because it returns null</p>