Sunday, May 21, 2017

How to Apply Multiple Middleware in Same method on Controller in Laravel 5.4

namespace App\Http\Controllers;
use Auth;
use Illuminate\Http\Request;

class UserProfileController extends Controller
{
    public function __construct(){
       $this->middleware('auth');
       $this->middleware('auth:admin');
    }
    public function show()
    {
        return view('user.profile.show');
    }
}

In this Controller I want to apply both middleware on show method. When I access this method using normal login, this displays content of view. But when I access this method using admin login, then this method redirects to normal login page.



via Brijesh Dubey

Advertisement