CakePHP - Checking from which controller and action request came -
hi there way check request came in cakephp ? need check if user has registered or not. cheers
maybe might help. here static class returns either controller name or action name:
class customrouter extends object { public static function controller_name() { $url_string = router::url(); return ( !empty( $url_string ) && is_string( $url_string ) ) ? explode( '/', $url_string )['1'] : null ; } public static function action_name() { $url_string = router::url(); return ( !empty( $url_string ) && is_string( $url_string ) ) ? explode( '/', $url_string )['2'] : 'index' ; } }
Comments
Post a Comment