Controller.php 779 B

12345678910111213141516171819202122232425
  1. <?php
  2. namespace App\Http\Controllers;
  3. use Illuminate\Foundation\Bus\DispatchesJobs;
  4. use Illuminate\Routing\Controller as BaseController;
  5. use Illuminate\Foundation\Validation\ValidatesRequests;
  6. use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
  7. class Controller extends BaseController
  8. {
  9. use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
  10. public function responseData($code, $msg, $data = '')
  11. {
  12. return ['code' => $code, 'msg' => $msg, 'data' => $data];
  13. }
  14. public function writeRequestLog($request, $channel = '')
  15. {
  16. llog('请求URL:' . $request->url(), $channel);
  17. llog('请求Header:' . json_encode($request->header()), $channel);
  18. llog('请求Body:' . json_encode($request->all()), $channel);
  19. }
  20. }