laravel - Custom filters - how do I make them fail? -
i'm creating package allows users use custom filter.
so far have method called:
public function testfilter(){ return false; }
in filters file, in main app have have:
route::filter('test.test', mypackage::testfilter());
and in routes, in main app have:
'before'=>'test.test'
my question is, how do filtering, i've done return false try , make filter fail, need else, app abort?
according laravel filters documentation
if filter returns response, response considered response request , route not execute. after filters on route cancelled.
that means have return response
cancel route proceeding.
it'll more logical have view displayed visitor when filter fails, , laravel trying do.
you can use app::abort()
or app::abort(404)
(with error codes) show error page.
Comments
Post a Comment