Filter not apply |
step1: make filter
Code: php spark make:filter MyFilter step2: edit app/filters/MyFilter.php PHP Code: public function before(RequestInterface $request, $arguments = null) step3: make controller Test php spark make:controller Test step4: edit : PHP Code: <?php step 5: edite app\Config\Filters PHP Code: use App\Filters\MyFilter; step 6: add route app\Config\Routes.php PHP Code: $routes->get('settings', 'Test::index'); Note : You can set the filter directly in routes. For this, you don't need to set the following: PHP Code: public $globals = [ just do the following: PHP Code: $routes->get('settings', 'Test::index' , ['filter' => 'my-filter']); now see http://localhost:8080/settings Code: string(17) "my filter is work" @motoroller If you follow the steps above, there is no problem. So it seems that your filter is not written correctly. |
Messages In This Thread |
Filter not apply - by motoroller - 12-11-2022, 03:40 AM
RE: Filter not apply - by datamweb - 12-11-2022, 02:38 PM
RE: Filter not apply - by motoroller - 12-11-2022, 03:27 PM
RE: Filter not apply - by datamweb - 12-19-2022, 11:59 AM
|