Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here

Hi-Folks/gh-actions-yaml-generator

331 stars
3 code files
View Hi-Folks/gh-actions-yaml-generator on GitHub

app/Http/Livewire/Dashboard/Daily.php

Open in GitHub
use App\Models\Configuration;
use App\Models\LogConfiguration;
use Illuminate\Support\Facades\DB;
use Livewire\Component;
 
class Daily extends Component
{
public $daily;
 
public function mount(): void
{
$date = DB::raw('DATE(`created_at`) as `date`');
if (config('database.default') === 'pgsql') {
$date = DB::raw("date_trunc('day', created_at) as date");
}
$this->daily = LogConfiguration::select(array(
$date,
DB::raw('count(*) as count')
))
->groupBy('date')
->orderBy('date', 'DESC') // or ASC
->pluck('count', 'date');
}
public function render(): \Illuminate\View\View
{
return view('livewire.dashboard.daily');
}
}

resources/views/livewire/dashboard/daily.blade.php

Open in GitHub
<div class="flex flex-col">
<div class="-my-2 overflow-x-auto sm:-mx-6 lg:-mx-8">
<div class="py-2 align-middle inline-block min-w-full sm:px-6 lg:px-8">
<div class="shadow overflow-hidden border-b border-gray-200 sm:rounded-lg">
<x-table.title>
Daily configurations
</x-table.title>
 
<table class="w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<x-table.th >Date</x-table.th>
<x-table.th >Counts</x-table.th>
 
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200">
 
@foreach($daily as $date => $count)
<tr class="">
<x-table.td>
{{ $date }}
</x-table.td>
<x-table.td align="right">
{{ $count }}
</x-table.td>
 
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>

resources/views/dashboard/index.blade.php

Open in GitHub
//
<div class="max-w-7xl mx-auto py-1 sm:px-6 lg:px-8">
<livewire:dashboard.daily></livewire:dashboard.daily>
</div>
//

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.