Welcome Guest, Not a member yet? Register   Sign In
question about routes and filter

(This post was last modified: 10-27-2021, 02:40 PM by Secux.)

is it possible to take a dynamic value from (:num) and use it in a filter?

PHP Code:
$routes->group('(:num)', ['subdomain' => 'test1''filter' => 'filtertest:$1'], function ($routes) { 

as $1 is (:num)

PHP Code:
public function before(RequestInterface $request$arguments null)

reurn: Array ( [0] => $1 )

and one more question is it possible to put ['get', 'post'] in a group? ?

For your second question, yes you should be able to set a route for get and post. Something like this:
PHP Code:
$routes->group('admin', function ($routes) {
    $routes->add('foo''Admin\Foo::index'); // any verb (GET, POST, PUT, DELETE…)
    $routes->get('bar''Admin\Bar::index'); // GET only
    $routes->post('biz''Admin\Biz::index'); // POST only
    $routes->match(['get''post'], 'baz''Admin\Baz::index'); // GET or POST only

See :
Grouping: http://codeigniter.com/user_guide/incomi...ing-routes
HTTP verbs: http://codeigniter.com/user_guide/incomi...-in-routes
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/

Theme © iAndrew 2016 - Forum software by © MyBB