mirror of
https://github.com/v2board/v2board.git
synced 2025-01-10 16:19:10 +08:00
update: add request log to middleware
This commit is contained in:
parent
1b8ec77bcc
commit
2285a7c92f
@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\Log;
|
||||
use App\Models\Plan;
|
||||
use App\Models\StatServer;
|
||||
use App\Models\StatUser;
|
||||
@ -46,5 +47,6 @@ class ResetLog extends Command
|
||||
{
|
||||
StatUser::where('record_at', '<', strtotime('-2 month', time()))->delete();
|
||||
StatServer::where('record_at', '<', strtotime('-2 month', time()))->delete();
|
||||
Log::where('created_at', '<', strtotime('-1 month', time()))->delete();
|
||||
}
|
||||
}
|
||||
|
@ -70,6 +70,7 @@ class Kernel extends HttpKernel
|
||||
'admin' => \App\Http\Middleware\Admin::class,
|
||||
'client' => \App\Http\Middleware\Client::class,
|
||||
'staff' => \App\Http\Middleware\Staff::class,
|
||||
'log' => \App\Http\Middleware\RequestLog::class
|
||||
];
|
||||
|
||||
/**
|
||||
|
24
app/Http/Middleware/RequestLog.php
Executable file
24
app/Http/Middleware/RequestLog.php
Executable file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
|
||||
class RequestLog
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
if ($request->method() === 'POST') {
|
||||
$path = $request->path();
|
||||
info("POST {$path}");
|
||||
};
|
||||
return $next($request);
|
||||
}
|
||||
}
|
@ -9,7 +9,7 @@ class AdminRoute
|
||||
{
|
||||
$router->group([
|
||||
'prefix' => config('v2board.secure_path', config('v2board.frontend_admin_path', hash('crc32b', config('app.key')))),
|
||||
'middleware' => 'admin'
|
||||
'middleware' => ['admin', 'log']
|
||||
], function ($router) {
|
||||
// Config
|
||||
$router->get ('/config/fetch', 'Admin\\ConfigController@fetch');
|
||||
|
Loading…
Reference in New Issue
Block a user