dimanche 29 novembre 2015

Laravel middlware 'only' fires for every route

Whatever I do crud middlware is always fired. However it should only be fired if $crud array is declared and only for routes it contains. However this is not the case it fires every time. Even if I say $crud = []; However if I declare ['only' => ['route1', 'route2']] then it works as expected.

<?php

class BaseController extends Controller
{
    /**
     * Routes which DO NOT load users notifications.
     * @var Array Routes without notifications.
     */
    public $notifications;
    /**
     * Routes which DONT require users account to be configured.
     * @var Array Routes needing configuration.
     */
    public $configured;
    /**
     * Routes which REQUIRE ownership of resource.
     * @var Array CRUD routes.
     */
    public $crud;

    public function __construct()
    {
        $this->middleware('auth', ['except' => $this->routes]);
        $this->middleware('configured', ['except' => $this->configured]);
        $this->middleware('notifications', ['except' => $this->notifications]);
        $this->middleware('crud', ['only' => $this->crud]);
    }
}



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1Ii7B6n
via IFTTT

Aucun commentaire:

Enregistrer un commentaire