title: how we can convert codeigniter code to laravel
body: <h2>view code</h2>
  
  <p>how we can convert this code to laravel </p>
  
  <pre><code>&lt;div class="property-grid"&gt;
            &lt;ul class="grid-holder col-3"&gt;
              &lt;?php foreach ($r as $row) : ?&gt;
                &lt;li class="grid-item type-rent"&gt;
                  &lt;div class="property-block"&gt; &lt;a href="&lt;?=base_url()?&gt;controller/buy_and_sell/&lt;?= $row-&gt;sub_id; ?&gt;" class="property-featured-image"&gt; &lt;img src="&lt;?=base_url()?&gt;real/images/background-images/sub-category-images/&lt;?= $row-&gt;sub_cat_images;?&gt;" alt=""&gt; &lt;span class="images-count"&gt;&lt;i class="fa fa-picture-o"&gt;&lt;/i&gt; 2&lt;/span&gt;&lt;/a&gt;
                    &lt;div class="property-info"&gt;
                      &lt;h4&gt;&lt;a href="&lt;?=base_url()?&gt;controller/buy_and_sell/&lt;?= $row-&gt;sub_id; ?&gt;"&gt;&lt;?= substr($row-&gt;sub_cat_name, 0, 24);?&gt;&lt;/a&gt;&lt;/h4&gt;
                      &lt;span class="location"&gt;NYC&lt;/span&gt;
                      &lt;div class="price"&gt;&lt;strong&gt;Records&lt;/strong&gt;
                        &lt;span&gt;
                          &lt;?php 
                          $data = $this-&gt;model-&gt;get_product_count($row-&gt;sub_id);
                            //echo array_shift($data);
                          echo $data['count'];
                          ?&gt;
                        &lt;/span&gt;
                      &lt;/div&gt;
                    &lt;/div&gt;
                  &lt;/div&gt;
                &lt;/li&gt;
              &lt;?php endforeach; ?&gt;
            &lt;/ul&gt;
          &lt;/div&gt;
  </code></pre>
  
  <h2>model code</h2>
  
  <pre><code>function get_product_count($id){
      $query = $this-&gt;db-&gt;query("select COUNT(sub_id) AS count FROM products WHERE products.sub_id = $id");
      return $query-&gt;row_array();
  }
  </code></pre>
  
  <p>this code convert to laravel
  /////////////////////////////////////////////////////////////////////////</p>
  
  <h2>this code convert</h2>
  
  <pre><code>&lt;span&gt;
                          &lt;?php 
                          $data = $this-&gt;model-&gt;get_product_count($row-&gt;sub_id);
                            //echo array_shift($data);
                          echo $data['count'];
                          ?&gt;
                        &lt;/span&gt;
  </code></pre>