title: laravel carbon get day names from a date column from a collection
body: <p>I have this collection from a database where I have a column called "event_date".</p>
  
  <p>What I want is just to get only the day names from that column that comes in a collection.</p>
  
  <p>I know you can use Carbon to get the name days through, for example, a method called <code>-&gt;format()</code>, however I get an error saying that this method does not exist.</p>
  
  <p>My code so far is as follows:</p>
  
  <pre><code>$collection = MyModel::all();
  </code></pre>
  
  <p>Inside there is the "event_date" property or column. From that, I want to get the names of the days to put them into an array or collection and finally count those days frequencies.</p>
  
  <p>In order to achieve this I have tried the following:</p>
  
  <p>I tried the <code>-&gt;pluck()</code> method as follows:</p>
  
  <pre><code>$filtered = collect([
              'myDates'=&gt;$collection-&gt;pluck('event_date'),
          ]);
  </code></pre>
  
  <p>And the <code>dd($filtered)</code> looks like as follows:</p>
  
  <pre><code>Collection {#209 ▼
    #items: array:1 [▼
      "myDates" =&gt; Collection {#243 ▼
        #items: array:30 [▼
          0 =&gt; Carbon {#244 ▼
            +"date": "2017-02-05 00:00:00.000000"
            +"timezone_type": 3
            +"timezone": "America/Mexico_City"
          }
          1 =&gt; Carbon {#218 ▼
            +"date": "2017-01-15 00:00:00.000000"
            +"timezone_type": 3
            +"timezone": "America/Mexico_City"
          }
          2 =&gt; Carbon {#250 ▼
            +"date": "2016-09-25 00:00:00.000000"
            +"timezone_type": 3
            +"timezone": "America/Mexico_City"
          }
          3 =&gt; Carbon {#249 ▼
            +"date": "2016-05-22 00:00:00.000000"
            +"timezone_type": 3
            +"timezone": "America/Mexico_City"
          }
  ...
  </code></pre>
  
  <p>I tried to get the day names as follows:</p>
  
  <pre><code>$Daynames = $filtered-&gt;each(function($item,$key){
              return $item-&gt;myDates-&gt;format('l');
          });
  </code></pre>
  
  <p>But I got the following error:</p>
  
  <blockquote>
    <p>Undefined property: Illuminate\Support\Collection::$myDates</p>
  </blockquote>
  
  <p>Any ideas to get only the daynames into an array or collection? Is there another way to do this?</p>