Authenticate.php 474 B

123456789101112131415161718192021
  1. <?php
  2. namespace App\Http\Middleware;
  3. use Illuminate\Auth\Middleware\Authenticate as Middleware;
  4. class Authenticate extends Middleware
  5. {
  6. /**
  7. * Get the path the user should be redirected to when they are not authenticated.
  8. *
  9. * @param \Illuminate\Http\Request $request
  10. * @return string|null
  11. */
  12. protected function redirectTo($request)
  13. {
  14. return response()->json([
  15. "error"=>"need authorization"
  16. ],401);
  17. }
  18. }