CheckAssetLogin.php 701 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace App\Http\Middleware;
  3. use App\Service\EmployeeService;
  4. use App\Service\JRFIDServerService;
  5. use Closure;
  6. class CheckAssetLogin
  7. {
  8. const account = "admin";
  9. const password = "admin,,bpm";
  10. /**
  11. * Handle an incoming request.
  12. *
  13. * @param \Illuminate\Http\Request $request
  14. * @param \Closure $next
  15. * @return mixed
  16. */
  17. public function handle($request, Closure $next)
  18. {
  19. $base = base64_encode(Self::account . ':' . Self::password);
  20. $token = "Basic " . $base;
  21. $data['header'] = ["Authorization: {$token}",'Content-Type:application/json'];
  22. $request->common_param = $data;
  23. return $next($request);
  24. }
  25. }