/**
* Get the current controller action name.
*
* @param bool $removeHttpMethod
* @return string|null
*/
public function action($removeHttpMethod = true)
{
if ($action = $this->router->currentRouteAction()) {
$action = last(Str::parseCallback($action, null));
if ($removeHttpMethod) {
$action = str_replace(['get', 'post', 'patch', 'put', 'delete'], '', $action);
}
return Str::snake($action, '-');
}
return null;
}