In this video we are going to see Solution for Admin Route Not Working After Stripe Integration.
So let see what is the problem and how can we solve this problem.
First of all let see the problem.
So switch to browser and lets login in with user credential first.
Enter email id and password.
Now click on login.
Now lets open the dashboard and you can see here its working good.
Now lets logout from here.
And now login with admin credential And here enter the admin email id and password now you can see here admin has been logged in .
But when I click on any admin menu.
You can see here it is redirecting me on login page.
What happen after the stripe installation, because its working well before the stripe payment gateway integration.
The reason of this problem is that.
When we run composer update command for updating the packages.
It will update all packages and replace all existing file with new one.
So the code which was written for admin authentication was removed from AttemptToAuthenticate.php file.
Which in vendor directory when I ran the composer update command
Ok, Alright
So now what can we do for solving the problem.
Lets open the AuthAdmin.php middleware and write the following code.


<pre><code className=\"php\">
<?php

namespace App\\Http\\Middleware;

use Closure;
use Illuminate\\Http\\Request;
use Illuminate\\Support\\Facades\\Auth;

class AuthAdmin
{
/**
* Handle an incoming request.
*
* @param \\Illuminate\\Http\\Request $request
* @param \\Closure $next
* @return mixed
*/
public function handle(Request $request, Closure $next)
{
if(Auth::user()->utype === 'ADM')
{
return $next($request);
}
else
{
session()->flush();
return redirect()->route('login');
}
return $next($request);
}
}
</code></pre>


Now its done so save it and lets check it.
So switch to browser and refresh the page.
Now lets enter the admin email and password.
Now click on login.
Alright now lets access the admin page.
And you can see here its working good now.
So in this way you can solve this problem.