Welcome Guest, Not a member yet? Register   Sign In
Get controller name and method
#5

(06-03-2019, 06:34 AM)kilishan Wrote: The routing has already been done at that point since it knows what controller to run, so you can always grab the Router instance and get them from there:

Code:
$router = service('router');
$controller  = $router->controllerName();
$method = $router->methodName();


Hi,

This was exactly what i was looking for, but i want to ask a few things.

By doing $router = service('router'); am i grabbing the already initiated service or creating a new one. 

Also is this a part of the docs, i mean did i miss something, or its something i should have already been aware of.
Reply


Messages In This Thread
Get controller name and method - by Smil3y - 06-02-2019, 10:59 PM
RE: Get controller name and method - by InsiteFX - 06-03-2019, 03:42 AM
RE: Get controller name and method - by kilishan - 06-03-2019, 06:34 AM
RE: Get controller name and method - by xGuRux - 06-06-2020, 03:32 AM
RE: Get controller name and method - by InsiteFX - 06-03-2019, 10:47 AM
RE: Get controller name and method - by Zeff - 06-04-2021, 06:36 AM



Theme © iAndrew 2016 - Forum software by © MyBB