反馈建议 标题:
邮箱:
内容:
  
[隐显目录]
function getCurrentControllerName()
{
    $class= getCurrentAction()['controller'];

    return substr(strrchr($class,'\\'),1);
}

function getCurrentMethodName()
{
    return getCurrentAction()['method'];
}


function getCurrentAction()
{
    $action = \Route::current()->getActionName();
    list($class, $method) = explode('@', $action);

    return ['controller' => $class, 'method' => $method];
}


function myGetRouteName(){
    $action = \Route::current()->getActionName();
    list($class, $method) = explode('@', $action);

    $rearr = [
        'model' => str_replace(
            '\\',
            '.',
            str_replace(
                'App\\Http\\Controllers\\',
                '',
                trim(
                    implode('\\', array_slice(explode('\\', $class), 0, -1)),
                    '\\'
                )
            )
        ),
        'controller' => str_replace(
            'Controller',
            '',
            substr(strrchr($class, '\\'), 1)
        ),
        'method' => $method
    ];

    return $rearr;
}