Welcome Guest, Not a member yet? Register   Sign In
routes with namespace & filter not work proper
#1

(This post was last modified: 07-07-2021, 04:49 AM by [email protected].)

Code:
$routes->get("dashboard", "DashboardController::index", ["namespace" => "\Modules\dashboard\Controllers\Admin"], ["filter" => "auth"]);

In the Above route namespace is work and filter is not work.
Code:
$routes->get("dashboard", "DashboardController::index", ["filter" => "auth"], ["namespace" => "\Modules\dashboard\Controllers\Admin"]);

In the Above route filter is work and namespace is not work.


I want both namespace & filter then what is the issue in above routes?
Reply
#2

try use kint to trace the error , d(), dd(), trace()
Reply
#3

Not 100% sure, but as far as I understand the documentation your filter and namespace options should be an array

PHP Code:
$routes->get("dashboard""DashboardController::index", ["namespace" => "\Modules\dashboard\Controllers\Admin","filter" => "auth"]); 
A good decision is based on knowledge and not on numbers. - Plato

Reply
#4

The last parameter to the routes is an $options array this is an associated array to hold all options to the route,
like namespace and filter

[namespace => name, filter => your_filter]
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#5

(This post was last modified: 07-08-2021, 12:22 AM by [email protected].)

(07-07-2021, 12:11 AM)salain Wrote: Not 100% sure, but as far as I understand the documentation your filter and namespace options should be an array

PHP Code:
$routes->get("dashboard""DashboardController::index", ["namespace" => "\Modules\dashboard\Controllers\Admin","filter" => "auth"]); 

Now, It's working. 
Thank You

(07-07-2021, 01:59 AM)InsiteFX Wrote: The last parameter to the routes is an $options array this is an associated array to hold all options to the route,
like namespace and filter

[namespace => name, filter => your_filter]

Now, It's working. 
Thank You 
Reply




Theme © iAndrew 2016 - Forum software by © MyBB