title: how can i get profit for today, last 7 days and last 30 days using laravel
body: <p><a href="https://i.stack.imgur.com/c4H5t.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/c4H5t.jpg" alt="enter image description here" /></a>I have a profit table in my database, when I retrieve data from database I need to filter profit according to date (for <code>today</code>, <code>last 7 days</code>, <code>last 30 days</code>).</p>
  <p>In my controller, I tried,</p>
  <pre><code>$todayProfit = Profit::whereDate('created_at',today())-&gt;get();
  return response()-&gt;json($todayProfit);
  </code></pre>
  <p>but it provides only 24 hours, but I need today profit.</p>
  <p>when i retrieve data to last 30 days using,</p>
  <pre><code>$lastMonthProfit = Profit::whereDate('created_at',today()-&gt;subDay(30))-&gt;get();
  return response()-&gt;json($lastMonthProfit );
  </code></pre>
  <p>it is not working for me,
  how can I solve</p>