it's me again with some Laravel questions, I need help with making a table in Laravel, like this:
What I have until now, is this:
This is my controller:
$workplaces = DB::table('activities')
->orderBy('workplace')
->select('workplace', DB::raw('count(*) as total'))
->groupby('workplace')
->get();
This is my blade view:
<tr>
<td>Workplaces</td>
<td>Total</td>
</tr>
@foreach($workplaces as $workplace)
<tr>
<td>
<td></td>
</tr>
@endforeach
An user from here helped me to make it count all activities, it helped a lot, but now I can't make it count the actives activities and inactives.
I've just tried to make two selects in one db::raw but it doesn't work, i've tried to have two variables like $workspaces and $workspaces_active_activities, but doesn't work too, I can't make two foreachs inside another one.
Sorry for my bad english, hope you guys understand it. Thanks for the attention.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire