add projet
This commit is contained in:
Executable
+28
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api;
|
||||
|
||||
use App\Models\Stats;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class StatsController extends BaseApiController
|
||||
{
|
||||
protected Stats $stats;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->stats = model(Stats::class);
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
try {
|
||||
$stats = $this->stats->findAll();
|
||||
return $this->success($stats, 'Statistics retrieved successfully');
|
||||
} catch (\Throwable $e) {
|
||||
log_message('error', 'Stats retrieval error: ' . $e->getMessage());
|
||||
return $this->respondError('Failed to retrieve statistics', Response::HTTP_INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user