title: Php Laravel call a function in the same model
body: <p>I have a model with 2 functions. Let's say the model's name is <code>Cars</code>. I am trying to call one function <code>brand</code> that returns an array so I can use it inside the other <code>getBrand</code> function.</p>
  
  <pre><code>public static function getBrand($data) {
      $brandVariable = $this-&gt;brand(); 
      for ($i=1; $i &lt; count($brandVariable ) ; $i++) { 
          //do something
      }
  }
  
  public static function brand() {
      $arrayValues = array(
           1 =&gt; 'Brand A',
           2 =&gt; 'Brand B',
      );
      return arrayValues;
  }
  </code></pre>
  
  <p>Since the values are in <code>brand</code> function, I need to pass it inside <code>getBrand</code>.</p>
  
  <p>I am getting an error in the <code>for</code> loop. I tried in another file (local PHP not Laravel) and it is working fine. But in Laravel, it is not getting the expected result.</p>