Support the ongoing development of Laravel.io →
posted 11 years ago
Requests

Hello everybody! My question is, where to find any documentation about the "beforeFiler()" method to use in the constructor of the controller. Which options does it except? I am trying to get work this method like in this example

$this->beforeFilter('admin_check', array('only' => 'getIndex|getString|postString|postTvLang|deleteTvLang|postRadio')); 

but it seems to be wrong, so it doesnt work.

Does anybody know whats wrong here?

Tankhs

Best regards

Alex

Last updated 3 years ago.
0

Not sure, but can you really separate a list of methods with a pipe like this? I know that you can do this with a list of filters when creating a route, but did you try to put your methods in an array like so?

$this->beforeFilter('admin_check', array('only' =>
                            array('getIndex', 'getString', 'postString'...)));
Last updated 3 years ago.
0

Your best bet are the API docs. Looking at the docs you can see that the beforeFilter call is instantiating a Before object. Following the rabbit trail all the way down you can see that the before object does indeed accept an array of items for only and except as DavidDomain suggests (look at the definition of the only var).

Last updated 3 years ago.
0

Thank you darryl, your answer is much more helpful than my suggestion. ;-)

Last updated 3 years ago.
0

Tanks guys. Nice, API docs is what I indeed need. Your answers are very helpful.

Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

abnemo abnemo Joined 12 Jun 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.