<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: maddrid</title>
    <description>The latest articles on Forem by maddrid (@maddrid).</description>
    <link>https://forem.com/maddrid</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F456850%2Fb9f55f7a-c470-469d-9f8d-d508870ad66f.jpeg</url>
      <title>Forem: maddrid</title>
      <link>https://forem.com/maddrid</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/maddrid"/>
    <language>en</language>
    <item>
      <title>Alternative eloquent model ?</title>
      <dc:creator>maddrid</dc:creator>
      <pubDate>Wed, 02 Mar 2022 21:24:54 +0000</pubDate>
      <link>https://forem.com/maddrid/alternative-eloquent-model--22jk</link>
      <guid>https://forem.com/maddrid/alternative-eloquent-model--22jk</guid>
      <description>&lt;p&gt;Current version of the eloquent model seems bloated with lots of unnecessary code for just querying the database .&lt;/p&gt;

&lt;p&gt;No reusable query builder inside model ,new query class for each db interogation&lt;br&gt;
 vast of model code (logic ) moved into controller.&lt;br&gt;
 This one doesn't inspire much also : &lt;a href="https://github.com/crocodic-studio/laravel-model"&gt;https://github.com/crocodic-studio/laravel-model&lt;/a&gt;&lt;br&gt;
display latest posts, most viewed posts, most comented  on  home page&lt;br&gt;
Each database interogation is a new model, new query builder, each result is a eloquent model. &lt;br&gt;
Each  result model has Concerns\HasAttributes,&lt;br&gt;
        Concerns\HasEvents,&lt;br&gt;
        Concerns\HasGlobalScopes,&lt;br&gt;
        Concerns\HasRelationships,&lt;br&gt;
        Concerns\HasTimestamps,&lt;br&gt;
        Concerns\HidesAttributes,&lt;br&gt;
        Concerns\GuardsAttributes,&lt;br&gt;
        ForwardsCalls;&lt;br&gt;
 to array , means looping on result , just looking for a simple model , not to bring hole script into memory  for extract 20 results&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>eloquent</category>
      <category>database</category>
      <category>help</category>
    </item>
    <item>
      <title>Cake\Collection\Collection vs Illuminate\Support\Collection </title>
      <dc:creator>maddrid</dc:creator>
      <pubDate>Mon, 19 Oct 2020 18:59:07 +0000</pubDate>
      <link>https://forem.com/maddrid/cake-collection-collection-vs-illuminate-support-collection-2ab0</link>
      <guid>https://forem.com/maddrid/cake-collection-collection-vs-illuminate-support-collection-2ab0</guid>
      <description>&lt;h1&gt;
  
  
  Any thoughts(benchmarks) on witch performs better  (faster , lower memory usage ) ?
&lt;/h1&gt;

&lt;p&gt;Any pro and cons   on &lt;br&gt;
   Cake\Collection\Collection &lt;br&gt;
vs &lt;br&gt;
   Illuminate\Support\Collection   &lt;/p&gt;

</description>
      <category>php</category>
      <category>laravel</category>
      <category>help</category>
      <category>cakephp</category>
    </item>
    <item>
      <title>Test , test ,test it again</title>
      <dc:creator>maddrid</dc:creator>
      <pubDate>Sat, 22 Aug 2020 20:10:14 +0000</pubDate>
      <link>https://forem.com/maddrid/test-test-test-52d</link>
      <guid>https://forem.com/maddrid/test-test-test-52d</guid>
      <description>&lt;h1&gt;
  
  
  My fist package
&lt;/h1&gt;

&lt;p&gt;First i needed to benchmark my php application.&lt;br&gt;
Then i came up with this..&lt;br&gt;
&lt;a href="https://packagist.org/packages/maddrid/bench"&gt;Link&lt;/a&gt; &lt;a href="https://packagist.org/packages/maddrid/bench"&gt;https://packagist.org/packages/maddrid/bench&lt;/a&gt;.&lt;br&gt;
Simple usage .&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Bench::start ('first');
 for($i=5;$i&amp;lt;3222200;$i++){
     if ($i==2232){
         Bench::start('22');
          \random_int(0, 1000);
     }
     $v = $i*32/18;

 }
 Bench::stop('22');
 Bench::stop('first');

 Bench ::printTimers ();
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;output&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Array
(
    [first] =&amp;gt; Array
        (
            [cpu_load] =&amp;gt; Not enabled
            [duration] =&amp;gt; 0.16000104
            [memory] =&amp;gt; 752 b
            [peak] =&amp;gt; 539.52 kb
        )

    [22] =&amp;gt; Array
        (
            [cpu_load] =&amp;gt; Not enabled
            [duration] =&amp;gt; 0.16000104
            [memory] =&amp;gt; NAN b
            [peak] =&amp;gt; 539.52 kb
        )

)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Not a big deal but made with love and a lot of coffee !!! &lt;/p&gt;

</description>
      <category>php</category>
      <category>benchmarking</category>
      <category>profiling</category>
    </item>
  </channel>
</rss>
