CheckCompanySort.php 576 B

12345678910111213141516171819202122232425
  1. <?php
  2. namespace App\Http\Middleware;
  3. use Closure;
  4. use Illuminate\Http\Request;
  5. class CheckCompanySort
  6. {
  7. /**
  8. * Handle an incoming request.
  9. *
  10. * @param \Illuminate\Http\Request $request
  11. * @param \Closure $next
  12. * @return mixed
  13. */
  14. public function handle(Request $request, Closure $next)
  15. {
  16. $member = session('member');
  17. if ($member && $member['CompanySort'] === 'AA') {
  18. return redirect()->route('member-login')->with(['url.intended' => url()->current()]);
  19. }
  20. return $next($request);
  21. }
  22. }