How to get data of previous week in Laravel 5.1?
<p>I want to get data inserted in previous week in Laravel 5.1. Currently I am using following query:</p>

<pre><code>$AgoDate=\Carbon\Carbon::now()-&gt;subWeek()-&gt;format('Y-m-d');  // returns 2016-02-03
$NowDate=\Carbon\Carbon::now()-&gt;format('Y-m-d');  // returns 2016-02-10
$query-&gt;whereBetween('created_on', array($AgoDate,$NowDate));
</code></pre>

<p>This returns last 7 days data, but I need last week's data, which means it should return data from 31st Jan to 6th Feb, i.e. the previous week.</p>

<p>Note: in my case Week starts from Sunday and ends on Saturday.</p>