Welcome Guest, Not a member yet? Register   Sign In
Cannot access protected property CodeIgniter\HTTP\IncomingRequest::$uri
#10

Do you use automatic routing? Or do you create all routes manually?
Without autorouting, you can change your filter to match the route names. This is a more reliable option. It does not depend on URLs. 
Try to implement this and you will be surprised how much less you need to edit new CI4 changes.
See https://codeigniter4.github.io/userguide...med-routes
Example code: 

PHP Code:
// Routes with names "as": users, about,...

$router    Services::router();
$routeName $router->getMatchedRouteOptions()['as'] ?? '';

if (
in_array($routeName, ['users''about'], true)) {
        // any actions

Simple CI 4 project for beginners codeigniter-expenses ( topic )
Reply


Messages In This Thread
RE: Cannot access protected property CodeIgniter\HTTP\IncomingRequest::$uri - by ozornick - 05-03-2024, 10:14 AM



Theme © iAndrew 2016 - Forum software by © MyBB