Commit 2ea2ae0f authored by Taylor Otwell's avatar Taylor Otwell

allow guard to be specified on middleaware

parent c2c8ab6f
......@@ -12,11 +12,12 @@ class Authenticate
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param string|null $guard
* @return mixed
*/
public function handle($request, Closure $next)
public function handle($request, Closure $next, $guard = null)
{
if (Auth::guest()) {
if (Auth::guard($guard)->guest()) {
if ($request->ajax()) {
return response('Unauthorized.', 401);
} else {
......
......@@ -12,11 +12,12 @@ class RedirectIfAuthenticated
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param string|null $guard
* @return mixed
*/
public function handle($request, Closure $next)
public function handle($request, Closure $next, $guard = null)
{
if (Auth::check()) {
if (Auth::guard($guard)->check()) {
return redirect('/');
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment