I am not able to group data for different days. I have some communications registered and with the default Created_at and Updated_at I would like to show these separate releases day by day .. VIEW
@foreach($messages as $message)
<li class="time-label">
<span class="bg-red">
{{ $message->updated_at }}
</span>
</li>
<li>
<i class="fa fa-envelope bg-blue"></i>
<div class="timeline-item">
<span class="time"><i class="fa fa-clock-o"></i> </span>
<h3 class="timeline-header"><a href="#"></a> ...</h3>
<div class="timeline-body">
{{ $message->message }}
</div>
<div class="timeline-footer">
<a class="btn btn-primary btn-xs">...</a>
</div>
</div>
</li>
@endforeach
TRY BY DAY CONTROLLER
public function timeline(Request $request){
$messages = Message::where('type_send', 1)->groupBy(function($date){
return Carbon::parse($date->created_at)->format('D');
});
return view('messages.timeline', compact('messages'));
}
EDITCONTROLLER
publicfunctiontimeline(Request$request){$messages=Message::orderBy('created_at','desc')->get()->groupBy(function($date){returnCarbon::parse($date->created_at)->format('Md');//groupingbyday});returnview('messages.timeline',compact('messages'));}
DUMPIN$NANAVIEW
Iwouldliketonowlisttheseparatemessagespermonth,whatwouldbethesolution?
VIEWIwasabletoshowthedayofthemonth,butnowIwanttolistthemessagesonthesamedayofthemonth
<ulclass="timeline">
@foreach($messages as $message)
<li class="time-label">
<span class="bg-red">
{{ $message->first()->updated_at }}
</span>
</li>
<li>
<i class="fa fa-envelope bg-blue"></i>
<div class="timeline-item">
<span class="time"><i class="fa fa-clock-o"></i> </span>
<h3 class="timeline-header"><a href="#"></a></h3>
<div class="timeline-body">
</div>
<div class="timeline-footer">
<a class="btn btn-primary btn-xs">...</a>
</div>
</div>
</li>
@endforeach
</ul>