gok-nine
gok-nine

Reputation: 303

Laravel App:before function not being called

I am having a problem with an application running Laravel 4.1 and trying to get filters working.

Within my filters file I have the following code residing in my filters.php:

echo 'here1';
App::before(function($request)
{
    die('here2');
    //
});

When I make a request to the application in my browser, then I get the first echo but I can't get the die to work indicating that this function is not being run.

I am not getting errors on screen or in the logs.

Can anybody shed any light as to why this before function is not being called?

Many thanks, G.

Upvotes: 0

Views: 385

Answers (1)

gok-nine
gok-nine

Reputation: 303

Matt Burrow pointed me in the right direction.

Filters are in fact disabled in testing mode as standard in Laravel (thank you Laravel documentation for making this obvious).

So, I put the following code into the configuration file for my testing environment and the filters started working:

Route::enableFilters();

Many thanks, G.

Upvotes: 1

Related Questions