fixing thsu frontend views
This commit is contained in:
20
app/Http/Controllers/StatsController.php
Normal file
20
app/Http/Controllers/StatsController.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Post;
|
||||
use App\Models\Thread;
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
class StatsController extends Controller
|
||||
{
|
||||
public function __invoke(): JsonResponse
|
||||
{
|
||||
return response()->json([
|
||||
'threads' => Thread::query()->withoutTrashed()->count(),
|
||||
'posts' => Post::query()->withoutTrashed()->count(),
|
||||
'users' => User::query()->count(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user