LoginController.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. namespace App\Http\Controllers\Auth;
  3. use App\Http\Controllers\Controller;
  4. use App\Providers\RouteServiceProvider;
  5. use Illuminate\Foundation\Auth\AuthenticatesUsers;
  6. use Illuminate\Http\Request;
  7. class LoginController extends Controller
  8. {
  9. /*
  10. |--------------------------------------------------------------------------
  11. | Login Controller
  12. |--------------------------------------------------------------------------
  13. |
  14. | This controller handles authenticating users for the application and
  15. | redirecting them to your home screen. The controller uses a trait
  16. | to conveniently provide its functionality to your applications.
  17. |
  18. */
  19. use AuthenticatesUsers;
  20. /**
  21. * Where to redirect users after login.
  22. *
  23. * @var string
  24. */
  25. protected $redirectTo = RouteServiceProvider::HOME;
  26. /**
  27. * Create a new controller instance.
  28. *
  29. * @return void
  30. */
  31. public function __construct()
  32. {
  33. $this->middleware('guest')->except('logout');
  34. }
  35. // To control users status,
  36. // overwrite original function on Illuminate\Foundation\AuthAuthenticatesUsers:
  37. protected function credentials(Request $request)
  38. {
  39. return array_merge($request->only($this->username(), 'password'),['isEnabled'=>true]);
  40. }
  41. }