HomeAuth.php 470 B

123456789101112131415161718192021222324
  1. <?php
  2. namespace App\Http\Middleware;
  3. use Closure;
  4. use Illuminate\Support\Facades\Auth;
  5. class HomeAuth
  6. {
  7. /**
  8. * @param $request
  9. * @param Closure $next
  10. * @param null $guard
  11. * @return mixed
  12. */
  13. public function handle($request, Closure $next, $guard = null)
  14. {
  15. if( $guard == 'member' && !Auth::guard($guard)->check() ){
  16. return redirect()->route('front.auth.login');
  17. }
  18. return $next($request);
  19. }
  20. }