You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
monitor-doc/app/Http/Controllers/GeneralController.php

28 lines
647 B
PHTML

<?php
namespace App\Http\Controllers;
2 years ago
use App\Models\Category;
use App\Models\Document;
class GeneralController extends Controller
{
2 years ago
public function index()
{
2 years ago
$count = 0;
$categories = Category::all();
foreach($categories as $category) {
foreach($category->documents as $docs) {
if ($docs->is_close_due != 0) {
$count += 1;
}
}
}
return inertia('Dashboard', [
2 years ago
'count_active' => $count,
2 years ago
'count_update' => Document::whereDate('due_date', '<=', now()->toDateString())->count(),
]);
}
}