Advertisement
meracle96

asddsadsa

May 1st, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. <?php
  2.  
  3. namespace App\Http\Controllers\Auth;
  4.  
  5. use Illuminate\Http\Request;
  6. use App\Http\Controllers\Controller;
  7. use Auth;
  8.  
  9. class AdminLoginController extends Controller
  10. {
  11. public function __construct()
  12. {
  13. $this->middleware('guest');
  14. }
  15.  
  16. public function showLoginForm()
  17. {
  18. return view('auth.admin-login');
  19. }
  20.  
  21. public function login(Request $request)
  22. {
  23. //Validate the form data
  24. $this->validate($request, [
  25. 'email' => 'required|email',
  26. 'password' => 'required|min:6'
  27. ]);
  28.  
  29. //Attempt to log the user in
  30. if (Auth::guard('admin')->attempt(['email' => $request->email, 'password' => $request->password], $request->remember)) {
  31. //if succesful, then redirect to their intended location
  32. return redirect()->intended(route('admin.dashboard'));
  33. }
  34.  
  35. //if unsuccesfull then redirect back to login
  36. return redirect()->back()->withInput($request->only('email','remember'));
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement