samedi 6 mai 2017

Route middleware does not redirect to login screen

I have this controller

class PrototypeController extends Controller
{
    // public function index(){
    //     $n = new Text;
    //     $posts = Text::all();
    //   return view('home',compact('posts'));
    // }
    public function __construct()
    {
        $this->middleware('auth');
    }

    public function index(){
        return view('text.dashboard');
    }
    public function bulkStatistics(){
        return view('text.bulkStatistics');
    }

that i want to use to authenticate users. I want a user to be logged in inorder to access the bulkStatistics route.

So far, i have made the views for user authentication by running php artisan auth:make

The views have been generated,but that does not prevent me being able to view bulkStatistics. My route middleware in kernel looks like this

protected $routeMiddleware = [
        'auth' => \Illuminate\Auth\Middleware\Authenticate::class,
        'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
        'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
        'can' => \Illuminate\Auth\Middleware\Authorize::class,
        'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
        'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
        'role' => \Zizaco\Entrust\Middleware\EntrustRole::class,
        'permission' => \Zizaco\Entrust\Middleware\EntrustPermission::class,
        'ability' => \Zizaco\Entrust\Middleware\EntrustAbility::class,
    ];



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire