title: Illegal offset type (Laravel)
body: <p>Ajax code in laravel with controller:</p>
  
  <pre><code>&lt;?php
  
  namespace genericlothing\Http\Controllers;
  
  use Illuminate\Http\Request;
  use genericlothing\Tienda;
  use DB;
  class AjaxController extends Controller
  {
        public function ajaxBodegasFind(Request $Request)
        {
          $str = "";
          $Tienda = new Tienda;
          $Bodegas = $Tienda-&gt;find($Request-&gt;ctienda)-&gt;bodegas;
  
          foreach($Bodegas as $Bodega){
            dd($Bodega);
            if($Bodega-&gt;estado == "0"){
                $str = $str.'&lt;option value="'.$Bodega-&gt;cod_bodega.'"&gt;'.$Bodega-&gt;direccion_bodega.'&lt;/option&gt;';
            }
          }
  
          return $str;
        }
  }
  </code></pre>
  
  <p>Error image:
  <a href="https://i.stack.imgur.com/kT2d4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kT2d4.png" alt="error img"></a></p>
  
  <p>Array dd($Bodega):
  <a href="https://i.stack.imgur.com/oNJUc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oNJUc.png" alt="dd bodega"></a></p>
  
  <p>I do not understand what's happening, I'm a little desperate...</p>