title: Data pass as objects as well as an array?
body: <p>I'm developing a system for manage directors in group of companies. I need to <code>filter</code> directors for companies as assigned. After I pass data from <code>controller</code> to view, when selecting companies the filter shows incorrect results.</p>
  
  <p><a href="https://i.stack.imgur.com/STC9P.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/STC9P.png" alt=""></a></p>
  
  <p><a href="https://i.stack.imgur.com/fTRRF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fTRRF.png" alt="enter image description here"></a></p>
  
  <p>The above results will show when I <code>console.log(this.directorships)</code> those. I think it's because for single data it'll show as an <code>array</code>. But if those multiple it'll show as <code>objects</code>. </p>
  
  <p>I'm looping those inside <code>for</code> loop as follows to print results.</p>
  
  <pre><code>for (let i = 0; i &lt; this.directorships.length; i++) {
       single_director = this.directorships[i].director_profile;
  
       finalArray.push(single_director);
  }
  </code></pre>
  
  <p><strong>MyController.php</strong></p>
  
  <pre><code>public function activeBoard($company_id){
          $directorship =  Directorship::with(['director_profile'])
              -&gt;where('master_data_id',$company_id)
              -&gt;get();
  
          $active_directors = $directorship-&gt;where('active',1);
  
          return $active_directors;
  
      }
  </code></pre>
  
  <p>Can anyone please tell me what's the mistake I have done here? Or are there any methods to do what I expect?</p>