sumitgroup
2 months ago
223
1
Laravel

How to Count Value According to date in Laravel?

Posted 2 months ago by sumitgroup

I have multiple fields store in my database table, and there are followup field in my database and there are multiple dates store in this field. Now i want count data according to current date. But i am unable to do it. Please let me know how i can do it.

Here are my controller code..

 public function index()
{
    $lead=Lead::orderBy('created_at', 'desc')->get()
    return view('admin.lead.index',compact('lead'));
}

and here are my view file..

<div class="panel-heading">
	@php
	$mytime = Carbon\Carbon::now();
	$checkdate=$mytime->toDateTimeString();
	@endphp
	<div class="panel-title">Today Follow Up's: 
		@foreach($lead as $lws)
			<span class="label label-warning">
				{{($lws->followup=$checkdate)}}
			</span>
		@endforeach
	</div>
	</div>

I am getting same data multiple times, but i want in this format (Suppose there are 5 date store according to today date and they should be count 5, so that i can get the today followup clients )

Please sign in or create an account to participate in this conversation.