<?php

namespace App\Http\Middleware;

use App\Services\LogService;
use Closure;

class LogPostRequest
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        if($request->method()!='GET'){
            LogService::log($request->fullUrl(),$request->method(),
                '请求：'.json_encode($request->all())
                .'请求头：'.json_encode($request->headers->all())
            );
        }
        return $next($request);
    }
}
