public function toArray() {
      $collectionArray = array();
      foreach ($this->data as $data) {
        $collectionArray[] = $data->toArray();
      }
      return $collectionArray;
    }
public function toArray() {
      $collectionArray = array();
      foreach ($this->data as $data) {
        $collectionArray[] = $data->toArray();
      }
      return $collectionArray;
    }
public function toArray ( ) { $ collectionArray = array ( ) ; foreach ( $ this -> data as $ data ) { $ collectionArray [ ] = $ data -> toArray ( ) ; } return $ collectionArray ; }
Collection based ToArray
should serialize each model into its
array
Collection based ToArray should serialize each model into its array