Isn't this the same problem as the other thread?
Apr 18, 2018
5
Level 1
How to group multiple tables under the same date?
Hi there, does anyone know how to sort data per day from multiple tables?
So I have multiple tables (actone, acttwo, actthree,...). Each one of them contains the timestamps with the created_at. How can I group actone, acttwo, actthree,... under the same date? Can anyone help please?
How I would like my view: https://prnt.sc/j6f73w
ChildController:
public function show($id)
{
$child = Child::find($id);
return view('admin.children.show')->withChild($child);
}
Show.blade.php:
<?php foreach ($child->actone as $actone): ?>
<td>{{$actone->category}}</td>
<td>{{$actone->time}}</td>
<td>{{$actone->name}}</td>
<td>{{$actone->rating}}</td>
<td>{{$actone->comment}}</td>
<td>{{$actone->created_at}}</td>
<?php endforeach; ?>
<?php foreach ($child->acttwo as $acttwo): ?>
<td>{{$acttwo->time_from}}</td>
<td>{{$acttwo->time_to}}</td>
<td>{{$acttwo->rating}}</td>
<td>{{$acttwo->comment}}</td>
<td>{{$acttwo->created_at}}</td>
<?php endforeach; ?>
<?php foreach ($child->actthree as $actthree): ?>
<h1>{{$actthree->medication}}</h1>
<h1>{{$actthree->time}}</h1>
<h1>{{$actthree->prescription}}</h1>
<h1>{{$actthree->comment}}</h1>
<td>{{$actthree->created_at}}</td>
<?php endforeach; ?>
...
Thanks!!
Please or to participate in this conversation.